description: You are given a sequence a_1, a_2, ..., a_n consisting of n pairwise distinct positive integers.
  
  Find \left⌊ \frac n 2 \right⌋ different pairs of integers x and y such that: 
  
    * x ≠ y; 
    * x and y appear in a; 
    * x~mod~y doesn't appear in a. 
  
  
  
  Note that some x or y can belong to multiple pairs.
  
  ⌊ x ⌋ denotes the floor function — the largest integer less than or equal to x. x~mod~y denotes the remainder from dividing x by y.
  
  If there are multiple solutions, print any of them. It can be shown that at least one solution always exists.
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 10^4) — the number of testcases.
  
  The first line of each testcase contains a single integer n (2 ≤ n ≤ 2 ⋅ 10^5) — the length of the sequence.
  
  The second line of each testcase contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^6).
  
  All numbers in the sequence are pairwise distinct. The sum of n over all testcases doesn't exceed 2 ⋅ 10^5.
  
  Output
  
  The answer for each testcase should contain \left⌊ \frac n 2 \right⌋ different pairs of integers x and y such that x ≠ y, x and y appear in a and x~mod~y doesn't appear in a. Print the pairs one after another.
  
  You can print the pairs in any order. However, the order of numbers in the pair should be exactly such that the first number is x and the second number is y. All pairs should be pairwise distinct.
  
  If there are multiple solutions, print any of them.
  
  Example
  
  Input
  
  
  4
  2
  1 4
  4
  2 8 3 4
  5
  3 8 5 9 7
  6
  2 7 5 3 4 8
  
  
  Output
  
  
  4 1
  8 2
  8 4
  9 5
  7 5
  8 7
  4 3
  5 2
  
  Note
  
  In the first testcase there are only two pairs: (1, 4) and (4, 1). \left⌊ \frac 2 2 \right⌋=1, so we have to find one pair. 1~mod~4=1, and 1 appears in a, so that pair is invalid. Thus, the only possible answer is a pair (4, 1).
  
  In the second testcase, we chose pairs 8~mod~2=0 and 8~mod~4=0. 0 doesn't appear in a, so that answer is valid. There are multiple possible answers for that testcase.
  
  In the third testcase, the chosen pairs are 9~mod~5=4 and 7~mod~5=2. Neither 4, nor 2, appears in a, so that answer is valid.
solution: /* package codechef; // don't place package name! */
  
  import java.util.*;
  import java.lang.*;
  import java.io.*;
  
  /* Name of the class has to be "Main" only if the class is public. */
  
  public class Codechef
  {
      static final PrintWriter out =new PrintWriter(System.out);
      static final FastReader sc = new FastReader();
      static long m  = 998244353;
  	public static void main (String[] args) throws java.lang.Exception
  	{
  		
  		long t = sc.nextLong();
  		while(t-- >0)
  		{
  		   int n = sc.nextInt();
  		   int arr[] = new int[n];
  		   HashSet<Integer> set = new HashSet<>();
  		   HashMap<Integer,Integer> map = new HashMap<>();
  		   for(int i=0 ; i<n ; i++)
  		   {
  			   arr[i] = sc.nextInt();
  			   set.add(arr[i]);
  		   }
  		   int x = (int) Math.floor(n/2);
  		   ArrayList<Pair> res = new ArrayList<>();
  		   int count=0;
  //		   Arrays.sort(arr);
  		   int min = Integer.MAX_VALUE;
  		   for(int i=0 ; i<n ; i++)
  		   {
  			   if(arr[i]<min) min=arr[i];
  		   }
  		   for(int i=0 ; i<n ; i++)
  		   {
  			   if(count==x) break;
  			   int m = arr[i]%min;
  			   if(!set.contains(m) && arr[i]!=min)
  			   {
  				   if(map.containsKey(arr[i]) && map.get(arr[i])==min)
  				   {
  					   continue;
  				   }
  				   else
  				   {
  				   res.add(new Pair(arr[i],min));
  				   map.put(arr[i], min);
  				   count++;
  				   }
  			   }
  		   }
  		   
  		   for(int i=0 ; i<n-1 ; i++)
  		   {
  			   if(count==x) break;
  			   int m = arr[i+1]%arr[i];
  			   int v = arr[i]%arr[i+1];
  			   if(!set.contains(m) && arr[i+1]!=arr[i])
  			   {
  				   if(map.containsKey(arr[i+1]) && map.get(arr[i+1])==arr[i])
  				   {
  					   continue;
  				   }
  				   else
  				   {
  				   res.add(new Pair(arr[i+1],arr[i]));
  				   map.put(arr[i+1], arr[i]);
  				   count++;
  				   }
  			   }
  			   if(!set.contains(v) && arr[i]!=arr[i+1])
  			   {
  				   if(map.containsKey(arr[i]) && map.get(arr[i])==arr[i+1])
  				   {
  					   continue;
  				   }
  				   else
  				   {
  				   res.add(new Pair(arr[i],arr[i+1]));
  				   map.put(arr[i], arr[i+1]);
  				   count++;
  				   }
  			   }
  			  
  			   
  			   if(count==x) break;
  		   }
  		   
  		  
  		   for(int i=0 ; i<n-1 ; i++)
  		   {
  			   if(count==x) break;
  			   int m = arr[i+1]%arr[i];
  			   int v = arr[i]%arr[i+1];
  			   if(!set.contains(m) && arr[i+1]!=arr[i])
  			   {
  				   if(map.containsKey(arr[i+1]) && map.get(arr[i+1])==arr[i])
  				   {
  					   continue;
  				   }
  				   else
  				   {
  				   res.add(new Pair(arr[i+1],arr[i]));
  				   map.put(arr[i+1], arr[i]);
  				   count++;
  				   }
  			   }
  			   if(!set.contains(v) && arr[i]!=arr[i+1])
  			   {
  				   if(map.containsKey(arr[i]) && map.get(arr[i])==arr[i+1])
  				   {
  					   continue;
  				   }
  				   else
  				   {
  				   res.add(new Pair(arr[i],arr[i+1]));
  				   map.put(arr[i], arr[i+1]);
  				   count++;
  				   }
  			   }
  			  
  			   
  			   if(count==x) break;
  		   }
  		   for(int i=0 ,j=n/2; i<n/2 && j<n  ; i++,j++)
  		   {
  			   if(count==x) break;
  			   int m = arr[i]%arr[j];
  			   int v = arr[j]%arr[i];
  				  
  				   if(!set.contains(m) && arr[i]!=arr[j])
  				   {
  					   
  					   if(map.containsKey(arr[i]) && map.get(arr[i])==arr[j])
  					   {
  						   continue;
  					   }
  					   else
  					   {
  					   res.add(new Pair(arr[i],arr[j]));
  					   map.put(arr[i], arr[j]);
  					   count++;
  					   }
  				   }
  				   if(!set.contains(v) && arr[i]!=arr[j])
  				   {
  					   
  					   if(map.containsKey(arr[j]) && map.get(arr[j])==arr[i])
  					   {
  						   continue;
  					   }
  					   else
  					   {
  					   res.add(new Pair(arr[j],arr[i]));
  					   map.put(arr[j], arr[i]);
  					   count++;
  					   }
  				   }
  				  
  				   
  				   if(count==x) break;
  		   }
  		   
  		  
  		   for(int i=0 ; i<res.size() ; i++)
  		   {
  			   int a = res.get(i).a;
  			   int b = res.get(i).b;
  			   out.print(a+" "+b);
  			   out.println();
  		   }
  		   
  		   
  		}
  		out.flush();
  	}
  	static class Pair
  	{
  		int a;
  		int b;
  		Pair(int a , int b)
  		{
  			this.a=a;
  			this.b=b;
  		}
  	}
  	static long gcd(long a , long b)
      {
          if(b==0) return a;
          return gcd(b,a%b);
      }
      
      static long lcm(long a , long b)
      {
          return (a*b)/gcd(a,b);
      }
      
      static long fastPower(long a , long b )
      {
          long res=1;
          while(b>0)
          {
              if((b&1)!=0)
              {
                  res = (res%m * a%m)%m;
              }
              a = (a%m * a%m)%m;
              b=b>>1;
              
          }
          return res;
      }
      
      static long modexp(long x, long n)
  {
      if (n == 0) {
          return 1;
      }
      else if (n % 2 == 0) {
          return modexp((x * x) % m, n / 2);
      }
      else {
          return (x * modexp((x * x) % m, (n - 1) / 2) % m);
      }
  }
   
  
   static long getFractionModulo(long a, long b)
  {
      long c = gcd(a, b);
   
      a = a / c;
      b = b / c;
   
      
      long  d = modexp(b, m - 2);
   
      
      long ans = ((a % m) * (d % m)) % m;
   
      return ans;
  }
  
      public static long power(long x, long y)
    {
        long temp;
        if (y == 0)
            return 1;
        temp = power(x, y / 2);
  
        if (y % 2 == 0)
            return modMult(temp,temp);
        else {
            if (y > 0)
                return modMult(x,modMult(temp,temp));
            else
                return (modMult(temp,temp)) / x;
        }
    }
    static long modMult(long a,long b) {
           return a*b%m;
       }
     static class FastReader {
          BufferedReader br;
          StringTokenizer st;
   
          public FastReader()
          {
              br = new BufferedReader(
                  new InputStreamReader(System.in));
          }
   
          String next()
          {
              while (st == null || !st.hasMoreElements()) {
                  try {
                      st = new StringTokenizer(br.readLine());
                  }
                  catch (IOException e) {
                      e.printStackTrace();
                  }
              }
              return st.nextToken();
          }
   
          int nextInt() { return Integer.parseInt(next()); }
   
          long nextLong() { return Long.parseLong(next()); }
   
          double nextDouble()
          {
              return Double.parseDouble(next());
          }
   
          String nextLine()
          {
              String str = "";
              try {
                  str = br.readLine();
              }
              catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
      }
  }