UFP swings to loss in first quarter