Firstly, the persons who are appointed as a result of an earlier selection (examination) are senior to those who are appointed on a subsequent selection (examination).
Secondly, the seniority of direct recruits selected in the same selection or examination by UPSC is in the order of merit in which they are selected for appointment on the recommendations of UPSC.
Their seniority is thus on the basis of the order of merit as per which they are selected. It is NOT on the basis of the date of confirmation in service.
In this regard, you may see O.M.No.20011/1/2008-Estt.(D) dated 11.11.2010 of the DOPT.
Also see: O.M. No. 20011/5/90-Estt. (D) dated 04.11.1992 of the DOPT, Govt of India.
Dr. Ashok Dhamija is a New Delhi based Supreme Court Advocate and author of law books. Read more about him by clicking here. List of his Forum Replies. List of his other articles. List of his Quora Answers. List of his YouTube Videos.