C # program to implement the above approach
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { class pair { public int first , second ; public pair ( int f , int s ) { this . first = f ; this . second = s ; } }