First-principles study of UC2 and U2C3