day_2 of prolog, without sorting