import java.io.BufferedReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.TreeSet;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author hitarthk
 */
public class C_331_C {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        HashMap<Integer,TreeSet<Pair>> h=new HashMap<>();
        int n=in.nextInt();
        int offset=100000;
        a=new long[200005];
        tree=new long[4*200005];
        b=new long[200005];
        Arrays.fill(b,Long.MIN_VALUE);

        ytree=new long[4*200005];
        build(1, 0, 200004, ytree, b);
        Pair[] p=new Pair[n];
        for(int i=0;i<n;i++){
            int x=in.nextInt();
            int y=in.nextInt();

            if(h.get(y-x)==null){
                h.put(y-x, new TreeSet<Pair>());
            }
            h.get(y-x).add(new Pair(x, y));
        }
        int[] w=new int[n];
        for(int i=0;i<n;i++){
            w[i]=in.nextInt();
        }

        boolean check=true;
        for(int i=0;i<n;i++){
            if(h.get(w[i])==null || h.get(w[i]).isEmpty()){
                check=false;
                break;
            }
            Pair cur=h.get(w[i]).first();
            long q1=query(1, 0, 200004, w[i]+offset+1, 200004, tree, a);
            long q2=query(1, 0, 200004, 0, w[i]+offset-1, ytree, b);
            //System.out.println(q1+" "+q2+" "+cur.x+" "+cur.y);
            if(cur.x<q1 || cur.y<=q2){
                check=false;
                break;
            }
            a[w[i]+offset]=cur.x;
            b[w[i]+offset]=cur.y;
            update(1, 0, 200004, w[i]+offset, tree, a);
            update(1, 0, 200004, w[i]+offset, ytree, b);
            p[i]=cur;
            h.get(w[i]).remove(cur);
        }
        if(check) {
            System.out.println("YES");
            for(int i=0;i<n;i++){
                System.out.println(p[i].x+" "+p[i].y);
            }
        }
        else{
            System.out.println("NO");
        }
    }

    static class Pair implements Comparable<Pair>{
        int id;
        int x;
        int y;
        public Pair(int x,int y){
            this.x=x;
            this.y=y;
        }
        @Override
        public int compareTo(Pair o) {
        //    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
            return this.x-o.x;
        }
        public String toString(){
            return this.x+" "+this.y;
        }
    }

    static long[] tree;
    static long[] a;
    static long[] b;
    static long[] ytree;
    public static void build(int node, int s, int e, long[] tree, long[] a) {
        if(s>e){
            return;
        }
        if (s == e) {
            tree[node] = a[s];
        } else {
            int mid = (s + e) >> 1;
            build(2 * node, s, mid, tree, a);
            build(2 * node + 1, mid + 1, e, tree, a);
            tree[node] = merge(tree[2 * node], tree[2 * node + 1]);
        }

    }

    public static void update(int node, int s, int e, int p, long[] tree, long[] a) {
        if (s == e) {
            tree[node]=a[p];
            return;
        }
        int mid = (s + e) >> 1;
        if (p <= mid) {
            update(2 * node, s, mid, p, tree, a);
        } else {
            update(2 * node + 1, mid + 1, e, p, tree, a);
        }
        tree[node] = merge(tree[2 * node], tree[2 * node + 1]);
    }

    public static long query(int node, int s, int e, int l, int r, long[] tree, long[] a) {
        if (s == l && e == r) {
            return tree[node];
        }
        int mid = (s + e) >> 1;
        if (r <= mid) {
            //System.out.println(l+" "+r);
            return query(2 * node, s, mid, l, r, tree, a);
        }
        if (l > mid) {
            return query(2 * node + 1, mid + 1, e, l, r, tree, a);
        }
        return merge(query(2 * node, s, mid, l, mid, tree, a), query(2 * node + 1, mid + 1, e, mid + 1, r, tree, a));
    }

    public static long merge(long l, long r) {
        return Math.max(l, r);
    }

}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class R331Div2C {
	static class Point implements Comparable<Point> {
		int x;
		int y;
		int w;
		public Point(int x,int y) {
			this.x=x;
			this.y=y;
			w=y-x;
		}
		@Override
		public int compareTo(Point o) {
			if (this.y < o.y) return -1;
			if (this.y > o.y) return 1;
			if (this.x < o.x) return -1;
			if (this.x > o.x) return 1;
			if (this.w < o.w) return -1;
			if (this.w > o.w) return 1;
			return 0;
		}
	}
	public static void main(String[] args) {
		FastScanner in=new FastScanner();
		int n=in.nextInt();
		Point[] a=new Point[n];
		for(int i=0;i<n;i++){
			a[i]=new Point(in.nextInt(),in.nextInt());
		}
		Arrays.sort(a);
		int[] b=new int[n];
		for(int i=0;i<n;i++){
			b[i]=in.nextInt();
		}

		boolean ans=true;
		for(int i=0;i<n;i++){
			if(a[i].w!=b[i]) {
				ans=false;
				break;
			}
		}
		PrintWriter out=new PrintWriter(System.out);
		out.println(ans?"YES":"NO");
		if(ans){
			for(int i=0;i<n;i++)
				out.println(a[i].x+" "+a[i].y);
		}
		out.flush();
		out.close();
	}
	static class FastScanner{
		BufferedReader br;
		StringTokenizer st;
		public FastScanner(){br=new BufferedReader(new InputStreamReader(System.in));}
		String nextToken(){
			while(st==null||!st.hasMoreElements())
				try{st=new StringTokenizer(br.readLine());}catch(Exception e){}
			return st.nextToken();
		}
		int nextInt(){return Integer.parseInt(nextToken());}
		long nextLong(){return Long.parseLong(nextToken());}
		double nextDouble(){return Double.parseDouble(nextToken());}
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;

public class R331Div2C {
	static class Point implements Comparable<Point> {
		int x;
		int y;
		int w;
		public Point(int x,int y) {
			this.x=x;
			this.y=y;
			w=y-x;
		}
		@Override
		public int compareTo(Point o) {
			if (this.w < o.w) return -1;
			if (this.w > o.w) return 1;
			if (this.x < o.x) return -1;
			if (this.x > o.x) return 1;
			if (this.y < o.y) return -1;
			if (this.y > o.y) return 1;
			return 0;
		}
	}
	public static void main(String[] args) {
		FastScanner in=new FastScanner();
		int n=in.nextInt();
		Point[] a=new Point[n];
		for(int i=0;i<n;i++){
			a[i]=new Point(in.nextInt(),in.nextInt());
		}
		Arrays.sort(a);
		int[] b=new int[n];
		for(int i=0;i<n;i++){
			b[i]=in.nextInt();
		}

		HashMap<Integer,ArrayList<Point>> map = new HashMap<Integer,ArrayList<Point>>();
		for(int i=0;i<n;i++){
			if(!map.containsKey(a[i].w))
				map.put(a[i].w,new ArrayList<Point>());
			map.get(a[i].w).add(a[i]);
		}
		Point[] ans=new Point[n];
		boolean f=true;
		for(int i=0;i<n;i++){
			if(map.containsKey(b[i])&&map.get(b[i]).size()>0){
				ans[i]=map.get(b[i]).get(0);
				map.get(b[i]).remove(0);
			}else{
				f=false;
				break;
			}
		}

		if(f){
			int[] d=new int[100000+1];
			int[] e=new int[100000+1];
			d[ans[0].x]=ans[0].y;
			e[ans[0].y]=ans[0].x;
			for(int i=0;i<n;i++){
				if(d[ans[i].x]<=ans[i].y){
					d[ans[i].x]=ans[i].y;
				}else{
					f=false;
					break;
				}
				if(e[ans[i].x]<=ans[i].y){
					e[ans[i].x]=ans[i].y;
				}else{
					f=false;
					break;
				}
			}
		}

		PrintWriter out=new PrintWriter(System.out);
		if(f){
			out.println("YES");
			for(int i=0;i<n;i++){
				out.println(ans[i].x+" "+ans[i].y);
			}
		}else{
			out.println("NO");
		}

		out.flush();
		out.close();
	}
	static class FastScanner{
		BufferedReader br;
		StringTokenizer st;
		public FastScanner(){br=new BufferedReader(new InputStreamReader(System.in));}
		String nextToken(){
			while(st==null||!st.hasMoreElements())
				try{st=new StringTokenizer(br.readLine());}catch(Exception e){}
			return st.nextToken();
		}
		int nextInt(){return Integer.parseInt(nextToken());}
		long nextLong(){return Long.parseLong(nextToken());}
		double nextDouble(){return Double.parseDouble(nextToken());}
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;

public class R331Div2C {
	static class Point implements Comparable<Point> {
		int x;
		int y;
		int w;
		public Point(int x,int y) {
			this.x=x;
			this.y=y;
			w=y-x;
		}
		@Override
		public int compareTo(Point o) {
			if (this.w < o.w) return -1;
			if (this.w > o.w) return 1;
			if (this.x < o.x) return -1;
			if (this.x > o.x) return 1;
			if (this.y < o.y) return -1;
			if (this.y > o.y) return 1;
			return 0;
		}
	}
	public static void main(String[] args) {
		FastScanner in=new FastScanner();
		int n=in.nextInt();
		Point[] a=new Point[n];
		for(int i=0;i<n;i++){
			a[i]=new Point(in.nextInt(),in.nextInt());
		}
		Arrays.sort(a);
		int[] b=new int[n];
		for(int i=0;i<n;i++){
			b[i]=in.nextInt();
		}

		HashMap<Integer,ArrayList<Point>> map = new HashMap<Integer,ArrayList<Point>>();
		for(int i=0;i<n;i++){
			if(!map.containsKey(a[i].w))
				map.put(a[i].w,new ArrayList<Point>());
			map.get(a[i].w).add(a[i]);
		}
		Point[] ans=new Point[n];
		boolean f=true;
		for(int i=0;i<n;i++){
			if(map.containsKey(b[i])&&map.get(b[i]).size()>0){
				ans[i]=map.get(b[i]).get(0);
				map.get(b[i]).remove(0);
			}else{
				f=false;
				break;
			}
		}

		if(f){
			int[] d=new int[100000+1];
			d[ans[0].x]=ans[0].y;
			for(int i=0;i<n;i++){
				if(d[ans[i].x]<=ans[i].y){
					d[ans[i].x]=ans[i].y;
				}else{
					f=false;
					break;
				}
			}
		}

		PrintWriter out=new PrintWriter(System.out);
		if(f){
			out.println("YES");
			for(int i=0;i<n;i++){
				out.println(ans[i].x+" "+ans[i].y);
			}
		}else{
			out.println("NO");
		}

		out.flush();
		out.close();
	}
	static class FastScanner{
		BufferedReader br;
		StringTokenizer st;
		public FastScanner(){br=new BufferedReader(new InputStreamReader(System.in));}
		String nextToken(){
			while(st==null||!st.hasMoreElements())
				try{st=new StringTokenizer(br.readLine());}catch(Exception e){}
			return st.nextToken();
		}
		int nextInt(){return Integer.parseInt(nextToken());}
		long nextLong(){return Long.parseLong(nextToken());}
		double nextDouble(){return Double.parseDouble(nextToken());}
	}
}


import java.util.*;
import java.text.*;
import java.io.*;
import java.math.*;

public class Solution{
    public static void main (String args[]){
        Scanner in = new Scanner (System.in);
        int n = in.nextInt();
        Point points[]=new Point[n];
        int weights[]=new int[n];

        for (int i=0;i<n;i++){
            int x=in.nextInt();
            int y=in.nextInt();
            points[i]=new Point(x,y);
        }

        for (int i=0;i<n;i++){
            weights[i]=in.nextInt();
        }

        Arrays.sort(points,new ComparatorWeight());
        LinkedList<Point> solution = solve(points,weights);
        if (solution==null) System.out.println("NO");
        else{
            System.out.println("YES");
            for (Point p:solution){
                System.out.println(p.x+" "+p.y);

            }
        }

    }

    public static class ComparatorWeight implements Comparator<Point> {
        public int compare(Point p1, Point p2){
            return p1.x+p1.y-p2.x-p2.y;
        }
    }

    public static class Point{
        int x;
        int y;
        public Point(int x,int y){
            this.x=x;
            this.y=y;
        }
    }

    public static LinkedList<Point> solve(Point points[],int weights[]){
        HashMap<Integer,LinkedList<Point>> map = new HashMap<Integer,LinkedList<Point>>();
        for (int i=0;i<points.length;i++){
            int key = points[i].y-points[i].x;
            if (!map.containsKey(key)) map.put(key,new LinkedList<Point>());
            map.get(key).addLast(points[i]);
        }

        LinkedList<Point> solution = new LinkedList<Point>();
        Point max_x = null;
        Point max_y = null;
        for (int i=0;i<weights.length;i++){
            if (!map.containsKey(weights[i])) {
                return null;
            }
            LinkedList<Point> l_points = map.get(weights[i]);
            Point p = l_points.pollFirst();

            if (max_x == null) max_x=p;
            else{
                if (p.x<=max_x.x && p.y<=max_x.y) {
                    return null;

                }
                if (p.x>=max_x.x) max_x=p;
            }
            if (max_y == null) max_y=p;
            else{
                if (p.y<=max_y.y && p.x<=max_y.x) {
                    return null;
                }
                if (p.y>=max_y.y) max_y=p;
            }
            solution.addLast(p);
        }
        return solution;
    }

}


import java.util.*;
import java.text.*;
import java.io.*;
import java.math.*;

public class Solution{
    public static void main (String args[]){
        Scanner in = new Scanner (System.in);
        int n = in.nextInt();
        Point points[]=new Point[n];
        int weights[]=new int[n];

        for (int i=0;i<n;i++){
            int x=in.nextInt();
            int y=in.nextInt();
            points[i]=new Point(x,y);
        }

        for (int i=0;i<n;i++){
            weights[i]=in.nextInt();
        }

        Arrays.sort(points,new ComparatorWeight());
        LinkedList<Point> solution = solve(points,weights);
        if (solution==null) System.out.println("NO");
        else{
            System.out.println("YES");
            for (Point p:solution){
                System.out.println(p.x+" "+p.y);

            }
        }

    }

    public static class ComparatorWeight implements Comparator<Point> {
        public int compare(Point p1, Point p2){
            return p1.x+p1.y-p2.x-p2.y;
        }
    }

    public static class Point{
        int x;
        int y;
        public Point(int x,int y){
            this.x=x;
            this.y=y;
        }
    }

    public static LinkedList<Point> solve(Point points[],int weights[]){
        HashMap<Integer,LinkedList<Point>> map = new HashMap<Integer,LinkedList<Point>>();
        for (int i=0;i<points.length;i++){
            int key = points[i].y-points[i].x;
            if (!map.containsKey(key)) map.put(key,new LinkedList<Point>());
            map.get(key).addLast(points[i]);
        }

        LinkedList<Point> solution = new LinkedList<Point>();
        int max_diag=0;
        for (int i=0;i<weights.length;i++){
            if (!map.containsKey(weights[i])) {
                return null;
            }
            LinkedList<Point> l_points = map.get(weights[i]);
            Point p = l_points.pollFirst();
            int diag=p.y+p.x;
            if (diag<max_diag) return null;
            else max_diag=diag;
            solution.addLast(p);
        }
        return solution;
    }

}


import java.util.*;
import java.text.*;
import java.io.*;
import java.math.*;

public class Solution{
    public static void main (String args[]){
        Scanner in = new Scanner (System.in);
        int n = in.nextInt();
        Point points[]=new Point[n];
        int weights[]=new int[n];

        for (int i=0;i<n;i++){
            int x=in.nextInt();
            int y=in.nextInt();
            points[i]=new Point(x,y);
        }

        for (int i=0;i<n;i++){
            weights[i]=in.nextInt();
        }

        Arrays.sort(points,new ComparatorWeight());
        LinkedList<Point> solution = solve(points,weights);
        if (solution==null) System.out.println("NO");
        else{
            System.out.println("YES");
            for (Point p:solution){
                System.out.println(p.x+" "+p.y);

            }
        }

    }

    public static class ComparatorWeight implements Comparator<Point> {
        public int compare(Point p1, Point p2){
            return p1.x+p1.y-p2.x-p2.y;
        }
    }

    public static class Point{
        int x;
        int y;
        public Point(int x,int y){
            this.x=x;
            this.y=y;
        }
    }

    public static LinkedList<Point> solve(Point points[],int weights[]){
        HashMap<Integer,LinkedList<Point>> map = new HashMap<Integer,LinkedList<Point>>();
        for (int i=0;i<points.length;i++){
            int key = points[i].y-points[i].x;
            if (!map.containsKey(key)) map.put(key,new LinkedList<Point>());
            map.get(key).addLast(points[i]);
        }

        LinkedList<Point> solution = new LinkedList<Point>();
        for (int i=0;i<weights.length;i++){
            if (!map.containsKey(weights[i])) {
                return null;
            }
            LinkedList<Point> l_points = map.get(weights[i]);
            solution.addLast(l_points.pollFirst());
        }
        return solution;
    }

}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
    /*freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);*/

    int n, k;
    cin >> n >> k; k--;
    vector<long long> vll(n);
    for (int i = 0; i < n; i++) cin >> vll[i];
    sort(vll.begin(), vll.end());
    int i = k/n, num1 = 0, num2 = 0, idx = 0;
    while (vll[idx] < vll[i]) idx++; num1 = idx;
    while (idx < n && vll[idx] == vll[i]) idx++; num2 = idx - num1;
    int j = (k - n*num1)/num2;
    cout << vll[i] << ' ' << vll[j];
    return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int main() {
    /*freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);*/

    int n, k;
    cin >> n >> k;
    vector<long long> vll(n);
    for (int i = 0; i < n; i++) cin >> vll[i];
    sort(vll.begin(), vll.end());
    int i = k/n, j = k % n;
    if (j == 0) j = n-1;
    else {i++; j--;}
    cout << vll[i-1] << ' ' << vll[j];
    return 0;
}


n, k = map(int, input().split())
a = sorted(map(int, input().split()))
x = a[(k - 1) // n]
p, c = a.index(x), a.count(x)
y = ((k - 1) - p * n) // c
print(x, a[y])


n, k = map(int, input().split())
a = sorted(map(int, input().split()))
v = a[(k - 1) // n]
p, c = a.index(x), a.count(x)
i = ((k - 1) - p * n) // c
print(v, a[i])


n, k = map(int, input().split())
a = list(map(int, input().split()))

a.sort()

k -= 1
t = k // n

s = t
while s >= 0 and a[s] == a[t]:
    s -= 1

s += 1

k -= s * n

t = s

while t < n and a[t] == a[s]:
    t += 1

print(a[s], a[k//(t-s)])


n, k = map(int, input().split())
a = list(map(int, input().split()))

a.sort()

k -= 1
print(a[k//n], a[k%n])


n, k = map(int, input().split())
a = sorted(map(int, input().split()))
print(a[(k - 1) // n], a[(k - 1) % n])


n=int(input())
l=input()
a=[int(l[i]) for i in range(n)]
b=[int(l[i+n])for i in range(n)]
a.sort()
b.sort()
c=[a[i]-b[i] for i in range(n)]
if max(c)<0 or min(c)>0:
    print("YES")
else:
    print("NO")


n,k=map(int,input().split())
l=list(map(int,input().split()))
d=dict()
s=set(l)
s=list(s)
s.sort()
l.sort()
for i in range(n):
    if l[i] not in d:
        d.update({l[i]:1})
    else:
        d[l[i]]+=1
y=s[0]
for j in s:
    if k<=d[j]*n:
        y=j
        break
    while(k>d[j]*n):
        k-=d[j]*n

u=0
while(k>=d[y]):
    k-=d[y]
    u+=1
if k==0:
    u-=1
print(y,l[u])


n,b=map(int,input().split())
l=list(map(int,input().split()))
b-=1
l.sort()
c=b//n
e=b%n
print(l[c],l[e])


n,k=map(int,input().split())
l=list(map(int,input().split()))
d=dict()
s=set(l)
s=list(s)
s.sort()
l.sort()
for i in range(n):
    if l[i] not in d:
        d.update({l[i]:1})
    else:
        d[l[i]]+=1
y=s[0]
for j in s:
    #print(j,k)
    if k<=d[j]*n:
        y=j
        break
    k-=d[j]*n

u=0
while(k>=d[y]):
    k-=d[y]
    u+=1
if k==0:
    u-=1
print(y,l[u])


n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
x=int((k-1)/n)
rem=(k-1)%n
print("{} {}".format(a[x],a[rem]))


n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
x=int((k-1)/n)
rem=int((k-1-a.index(a[x])*n)/a.count(a[x]))
print("{} {}".format(a[x],a[rem]))


# your code goes here
n, k = map(int, input().split())
series = list(map(int, input().split()))
series.sort()
digit1 = series[(k-1)//n]
ind, cnt = series.index(digit1), series.count(digit1)
digit2_ind = ((k-1) - ind * n)//cnt
digit2 = series[digit2_ind]
print(digit1,digit2)


# your code goes here
n, k = map(int, input().split())
series = list(map(int, input().split()))
series.sort()
print(series[k//n],series[k%n])


# your code goes here
n, k = map(int, input().split())
series = list(map(int, input().split()))
series.sort()
print(series[(k-1)//n],series[(k-1)%n])


N,k=map(int,input().split())
k-=1
A=list(map(int,input().split()))
A.sort()

Rep={}
Rep[A[0]]=[0,1]
for i in range(1,N):
    if(A[i]==A[i-1]):
        Rep[A[i]][1]+=1
    else:
        Rep[A[i]]=[i,1]

x=k//N
first=A[x]
k+=1
ind=Rep[first][0]
k-=(N*ind)
second=A[0]
k-=Rep[A[0]][1]*Rep[A[x]][1]
done=False
for i in range(1,N):
    if(k<=0):
        done=True
        second=A[i-1]
        break
    if(A[i]!=A[i-1]):
        k-=Rep[A[i]][1]*Rep[A[x]][1]
if(not done):
    second=A[-1]

print(first,second)


N,k=map(int,input().split())
k-=1
A=list(map(int,input().split()))
A.sort()

x=k//N
y=k%N
first=A[x]
second=A[y]

print(first,second)


N,k=map(int,input().split())
k-=1
A=list(map(int,input().split()))
A.sort()

Rep={}
Rep[A[0]]=[0,1]
for i in range(1,N):
    if(A[i]==A[i-1]):
        Rep[A[i]][1]+=1
    else:
        Rep[A[i]]=[i,1]

x=k//N
first=A[x]
k+=1
ind=Rep[first][0]
k-=(N*ind)
second=A[0]
k-=Rep[A[0]][1]
done=False
for i in range(1,N):
    if(k<=0):
        done=True
        second=A[i-1]
        break
    if(A[i]!=A[i-1]):
        k-=Rep[A[i]][1]
if(not done):
    second=A[-1]

print(first,second)


n , k = map(int , input().split())
inp = list(map(int , input().split()))
srt = sorted(inp)
if n == 1:
     print(srt[0] , srt[0])
else:
     a = (k - 1) // n
     num = 0
     for i in range(n - 1 , -1 , -1):
          if srt[i] == srt[a]:
               num += 1
               a = i
     b = (k - n * a - 1) // num
     print(srt[a] , srt[b])


n, k = list(map(int, input().split()));
k -= 1;

a = list(map(int, input().split()));
a.sort();

print(a[int(k/n)], end = " ");

t = 1;
i = 0;
while i < n:
    t = 1;
    while i + t < n:
        if a[i] == a[i + t]:
            t += 1;
        else:
            break;
    if t*n > k:
        break;
    k -= t*n;

    if i + t >= n:
        break;

    i += t;

print(a[int(k/t)]);


n, k = map(int, input().split())
t = list(map(int, input().split()))
t.sort()
print(t[(k - 1) // n], t[(k - 1) % n])


n, k = map(int, input().split())
t = list(map(int, input().split()))

t.sort()
k -= 1
i = k // n
x = t[i]
y = t.count(x)

if t[0] == x: i = 0
else:
    i -= 1
    while t[i] == x: i -= 1
    i += 1

print(x, t[(k - i * n) // y])


n , k = map(int , input().split())
inp = list(map(int , input().split()))
ans = inp
inp = list(set(inp))
n = len(inp)
srtt = sorted(ans)
srt = sorted(inp)
if n == 1:
     print(srt[0] , srt[0])
elif k % n == 0:
     print(srt[k // n - 1] , srt[-1])
else:

     print(srtt[k // n] , srt[k % n - 1])


n , k = map(int , input().split())
inp = list(map(int , input().split()))
srt = sorted(inp)
if n == 1:
     print(srt[0] , srt[0])
elif k % n == 0:
     print(srt[k // n - 1] , srt[1])
else:
     k1 = k
     cnt = 0
     while k1 > n:
          k1 -= n
          cnt += 1
     print(srt[cnt] , srt[k1 - 1])


n , k = map(int , input().split())
inp = list(map(int , input().split()))
srt = sorted(inp)
k1 = k
cnt = 0
while k1 > n:
     k1 -= n
     cnt += 1
print(srt[cnt] , srt[k1 - 1])


n , k = map(int , input().split())
inp = list(map(int , input().split()))
srt = sorted(inp)
if n == 1:
     print(srt[0])
elif k % n == 0:
     print(srt[k // n - 1] , srt[1])
else:
     k1 = k
     cnt = 0
     while k1 > n:
          k1 -= n
          cnt += 1
     print(srt[cnt] , srt[k1 - 1])


n , k = map(int , input().split())
inp = list(map(int , input().split()))
srt = sorted(inp)
if k % n == 0:
     print(srt[k // n - 1] , srt[1])
else:
     k1 = k
     cnt = 0
     while k1 > n:
          k1 -= n
          cnt += 1
     print(srt[cnt] , srt[k1 - 1])


n , k = map(int , input().split())
inp = list(map(int , input().split()))
srt = sorted(inp)
if n == 1:
     print(srt[0] , srt[0])
elif k % n == 0:
     print(srt[k // n - 1] , srt[-1])
else:
     k1 = k
     cnt = 0
     while k1 > n:
          k1 -= n
          cnt += 1
     print(srt[cnt] , srt[k1 - 1])


n,k=input().split()
n=int(n)
k=int(k)
a=[0]*n
a=input().split()
for i in range (n):
    a[i]=int(a[i])
a.sort()
x = a[(k - 1) // n]
p=a.index(x)
c=a.count(x)
y = ((k - 1) - p * n) // c
print(x, a[y])


n,k=input().split()
n=int(n)
k=int(k)
matrix=[0]*(n**2)
for i in range (n**2):
    matrix[i]=[0]*2
arr=[0]*n
arr=input().split()
for i in range (n):
    arr[i]=int(arr[i])
count=0
for t in range (n):
    for j in range (n):
        matrix[count][0]=arr[j]
        matrix[count][1]=arr[t]
        count+=1
matrix.sort()
print (matrix[k-1][0],matrix[k-1][1])


n, k = map(int, input().split())

t = list(map(int, input().split()))

t.sort()

k -= 1

i = k // n

x = t[i]

y = t.count(x)

if t[0] == x: i = 0

else:

    i -= 1

    while t[i] == x: i -= 1

    i += 1

print(x, t[(k - i * n) // y])

# Made By Mostafa_Khaled


from collections import *

n, k = map(int, input().split())
d = defaultdict(int)
a = sorted(map(int,input().split()))
for x in a:
    d[x] += 1
s = sorted(d.items())
#print(s)
summ=0
for x, y in s:
    if (k-summ)<=y*n:
       #print(k)
        print(x, a[(k - 1-summ)//y])
        break

    summ+=(y*n)


n,k=map(int,input().split())
ar=list(map(int,input().split()))
ar=sorted(ar)
summ=0
flag=True
for i  in range(n):
   if (i+1)*n>=k:
     break

x=ar.count(ar[i])
c=ar.index(ar[i])
y=((k-1)-c*n)//x
print(ar[i],ar[y])


n,k=map(int,input().split())
ar=list(map(int,input().split()))
ar=sorted(ar)
summ=0
flag=True
for i  in range(n):
   if (i+1)*n>=k:
     break

x=ar.count(ar[i])
c=ar.index(ar[i])
y=((k)-c*n)//x
print(ar[i],ar[y-1])


from collections import *

n, k = map(int, input().split())
d = defaultdict(int)
a = sorted(map(int,input().split()))
for x in a:
    d[x] += 1
s = sorted(d.items())
#print(s)
for x, y in s:
    if k <= y * n:
        print(k)
        print(x, a[(k - 1)%y])
        break
    k -= y * n


n, k = map(int, input().split())
a = sorted(map(int, input().split()))
x = a[(k - 1) // n]
p, c = a.index(x), a.count(x)
y = ((k - 1) - p * n) // c
print(x, a[y])


n,k=map(int,input().split())
a = list(map(int, input().strip().split(' ')))
a.sort()
b = [0]*(n+1)
h=int(0)
i=int(1)
b[0]=1
n1=int(n)
if n==1:
    print(a[0],a[0])
    h=1
while(h==0):
    if a[i]==a[i-1]:
        del a[i]
        b[i-1]+=1
        n-=1
    else:
        i+=1
        b[i-1]+=1
    if i == n:
        break
i=int(0)
j=int(0)

while(h==0):
    if k>b[i]*n1:
        k-=b[i]*n1
        i+=1
    else:
        if k>b[i]*b[j]:
            k-=b[i]*b[j]
            j+=1
        else:
            print(a[i],a[j])
            break


n,k=map(int,input().split())
a = list(map(int, input().strip().split(' ')))
a.sort()
b = [0]*(n+1)
h=int(0)
i=int(1)
b[0]=1
while(h==0):
    if a[i]==a[i-1]:
        del a[i]
        b[i-1]+=1
        n-=1
    else:
        i+=1
        b[i-1]+=1
    if i == n:
        h = 1
        break
i=int(0)
j=int(0)

while(k>0):
    if k<=b[i]*b[j]:
        print(a[i],a[j])
        break
    else:
        k-=b[i]*b[j]
        j+=1
        if j==n:
            j=0
            i+=1


n,k=map(int,input().split())
a = list(map(int, input().strip().split(' ')))
a.sort()
b = [0]*(n+1)
h=int(0)
i=int(1)
b[0]=1
if n==1:
    print(a[0],a[0])
    h=1
while(h==0):
    if a[i]==a[i-1]:
        del a[i]
        b[i-1]+=1
        n-=1
    else:
        i+=1
        b[i-1]+=1
    if i == n:
        break
i=int(0)
j=int(0)

while(h==0):
    if k<=b[i]*b[j]:
        print(a[i],a[j])
        break
    else:
        k-=b[i]*b[j]
        j+=1
        if j==n:
            j=0
            i+=1


n,k=map(int,input().split())
a = list(map(int, input().strip().split(' ')))
a.sort()
print(a[int((k-1)/n)],a[k%n-1])


n,k=map(int,input().split())
alist=[int(x) for x in input().split()]

permutationlist=[]

for i in range(0,n):
    for j in range(0,n):
        permutationlist.append((alist[i],alist[j]))

permutationlist.sort()

print(str(permutationlist[k-1][0])+' '+str(permutationlist[k-1][1]))


import math

n,k=map(int,input().split())
alist=[int(x) for x in input().split()]

alist.sort()

i=math.ceil(k/n)

if alist.count(alist[i-1])==1:
    print('{0} {1}'.format(alist[i-1],alist[k+(1-i)*n-1]))

else:
    j=math.ceil((k-alist.index(alist[i-1])*(n-1))/(alist.count(alist[i-1])))
    print('{0} {1}'.format(alist[i-1],alist[j-1]))


import itertools

n,k=map(int,input().split())
alist=[int(x) for x in input().split()]

finallist=list(itertools.product(alist,alist))

finallist.sort()

print(finallist[k-1])


import itertools

n,k=map(int,input().split())
alist=[int(x) for x in input().split()]

finallist=list(itertools.product(alist,alist))

finallist.sort()

print('{0} {1}'.format(str(finallist[k-1][0]),str(finallist[k-1][1])))


import math

n,k=map(int,input().split())
alist=[int(x) for x in input().split()]

alist.sort()

i=math.ceil(k/n)

if alist.count(alist[i-1])==1:
    print('{0} {1}'.format(alist[i-1],alist[k+(1-i)*n-1]))

else:
    j=math.ceil((k-alist.index(alist[i-1]))/(alist.count(alist[i-1])))
    print('{0} {1}'.format(alist[i-1],alist[j-1]))


n,k=map(int,input().split())
alist=[int(x) for x in input().split()]

alist.sort()

permutationlist=[]

for i in range(0,n):
    for j in range(0,n):
        permutationlist.append((alist[i],alist[j]))

permutationlist.sort()

print(str(permutationlist[k-1][0])+' '+str(permutationlist[k-1][1]))


import math

n,k=map(int,input().split())
alist=[int(x) for x in input().split()]

alist.sort()

i=math.ceil(k/n)

if alist.count(alist[i-1])==1:
    print('{0} {1}'.format(alist[i-1],alist[k+(1-i)*n-1]))

else:
    j=math.ceil((k+(1-i)*n)/alist.count(alist[i-1]))
    print('{0} {1}'.format(alist[i-1],alist[j-1]))


n,k=map(int,input().split())
alist=[int(x) for x in input().split()]

alist.sort()
aset=set(alist)

permutationlist=[]

for distinct in aset:
    for i in range(0,alist.count(distinct)):
        for j in range(0,n):
            permutationlist.append((distinct,alist[j]))

permutationlist.sort()

print(str(permutationlist[k-1][0])+' '+str(permutationlist[k-1][1]))
print(permutationlist)


import math

n,k=map(int,input().split())
alist=[int(x) for x in input().split()]

alist.sort()

i=math.ceil(k/n)

if alist.count(alist[i-1])==1:
    print('{0} {1}'.format(alist[i-1],alist[k+(1-i)*n-1]))

else:
    blist=alist+alist
    j=math.ceil((k+(1-i)*n)/alist.count(alist[i-1]))
    print('{0} {1}'.format(alist[i-1],blist[j-1]))


n,k=map(int,input().split())
alist=[int(x) for x in input().split()]

alist.sort()
aset=set(alist)

permutationlist=[]

for distinct in aset:
    for i in range(0,alist.count(distinct)):
        for j in range(0,n):
            permutationlist.append((distinct,alist[j]))

permutationlist.sort()

print(str(permutationlist[k-1][0])+' '+str(permutationlist[k-1][1]))


import math

n,k=map(int,input().split())
alist=[int(x) for x in input().split()]

alist.sort()

i=math.ceil(k/n)

if alist.count(alist[i-1])==1:
    print('{0} {1}'.format(alist[i-1],alist[k+(1-i)*n-1]))

else:
    j=math.floor((k-alist.index(alist[i-1])*n-1)/(alist.count(alist[i-1])))
    print('{0} {1}'.format(alist[i-1],alist[j]))


n , k = map(int , input().split())
t = list(map(int , input().split()))
t.sort()
k -= 1
i = k // n
x = t[i]
y = t.count(x)
if t[0] == x :
    i = 0
else :
    i -= 1
    while t[i] == x :
        i -= 1
    i += 1
print(x , t[(k - i * n) // y])


I = ->{gets.split.map &:to_i}
n, m = I[]
m -= 1
a = I[].sort
h = Hash.new(0)
a.each{|_| h[_] += 1}
h.sort.each{|k, v|
    if m < v * n
        m /= v
        puts "#{k} #{a[m]}"
        break
    else
        m -= v * n
    end
}


n,k=gets.split.map(&:to_i)
a=gets.split.map(&:to_i)

a.sort!
k-=1
input=[]
n.times{|i|
        if i>0&&a[i]==a[i-1]
                input[input.length-1][1]+=1
        else
                input.push([a[i],1])
        end
}
input.each{|t|
        if k<t[1]*n
                p t[0]
                p a[k/t[1]]
                exit
        else
                k-=n*t[1]
        end
}


n,k=gets.split.map(&:to_i)
a=gets.split.map(&:to_i)

a.sort!
k-=1
n.times{|i|
        if k<n
                p a[i]
                p a[k]
                exit
        else
                k-=n
        end
}


n, k = STDIN.readline.split.map {|s| s.to_i }
k -= 1
data = STDIN.readline.split.map {|s| s.to_i }.sort
ai = k/n
a = data[ai]
low = ai
while low-1 >= 0 and data[low-1] == a
  low -= 1
end
high = ai
while high+1 < n and data[high+1] == a
  high += 1
end
b = data[(k - low*n)/(high-low+1)]
puts '%d %d' % [a, b]


n, k = STDIN.readline.split.map {|s| s.to_i }
k -= 1
data = STDIN.readline.split.map {|s| s.to_i }.sort
ai = k/n
a = data[ai]
low = ai-1
while low >= 0 and data[low] == a
  low -= 1
end
high = ai+1
while high < n and data[high] == a
  high += 1
end
b = data[(k - low*n)/(high-low+1)]
puts '%d %d' % [a, b]


n, k = STDIN.readline.split.map {|s| s.to_i }
data = STDIN.readline.split.map {|s| s.to_i }.sort
k -= 1
a = data[k/n]
b = data[k%n]
puts '%d %d' % [a, b]


n,k = gets.split.map(&:to_i)
k -= 1
a = gets.split.map(&:to_i).uniq.sort

d,m = k.divmod n

print a[d], " ",a[m]


n,k = gets.split.map(&:to_i)
k -= 1
a = gets.split.map(&:to_i).sort

d,m = k.divmod n

s = a.select{|e|e == a[d] }.size

if s > 1
  f = a.index(a[d])*n
  m = (k-f)/s
end

print a[d], " ",a[m]


#!/usr/bin/ruby
# coding: utf-8

n, k = *$stdin.gets.chomp.split.map(&:to_i)
as = $stdin.gets.chomp.split.map(&:to_i)

h = Hash.new { 0 }
as.each do |a|
  h[a] += 1
end

h.keys.sort.each do |a1|
  c1 = h[a1]
  if k-c1*n <= 0
    h.keys.sort.each do |a2|
      c2 = h[a2]
      if k-c1*c2 <= 0
        puts [a1, a2].join(' ')
        exit 0
      end
      k -= c1*c2
    end
  end
  k -= c1*n
end


#!/usr/bin/ruby
# coding: utf-8

n, k = *$stdin.gets.chomp.split.map(&:to_i)
as = $stdin.gets.chomp.split.map(&:to_i).sort

k -= 1
puts [as[k/n], as[k%n]].join(' ')


n,k=gets.chomp.split.collect{|a| a.to_i}
arr=gets.chomp.split.collect{|a| a.to_i}.sort
k=k-1
print arr[k/n]," " , arr[k%(n)].to_s


n,k=gets.chomp.split.collect{|a| a.to_i}
arr=gets.chomp.split.collect{|a| a.to_i}.sort
k=k-1
if arr[k/n] == arr[k/n+1] || arr[k/n]==arr[k/n-1]
m=arr.count arr[k/n]
z=arr.index arr[k/n]

print arr[k/n]," ",arr[(k-z*n)/m]
else
print arr[k/n]," " , arr[k%(n)].to_s
end


n,k=gets.chomp.split.collect{|a| a.to_i}
arr=gets.chomp.split.collect{|a| a.to_i}.sort
k=k-1
if arr[k/n] == arr[k/n+1] || arr[k/n]==arr[k/n-1]
print arr[k/n]," ",arr[k/n]
else
print arr[k/n]," " , arr[k%(n)].to_s
end


n,k=gets.chomp.split.collect{|a| a.to_i}
arr=gets.chomp.split.collect{|a| a.to_i}.sort
k=k-1
if arr[k/n] == arr[k/n+1] || arr[k/n]==arr[k/n-1]
m=arr.count arr[k/n]
print arr[k/n]," ",arr[(k/m)]
else
print arr[k/n]," " , arr[k%(n)].to_s
end


n, k = gets.split.collect{|i| i.to_i}
numbers = gets.split.collect{|i| i.to_i}.sort

k -= 1
f_idx = k / n
s_idx = k % n

puts [numbers[f_idx], numbers[s_idx]].join(" ")


n, k = gets.split.collect{|i| i.to_i}
numbers = gets.split.collect{|i| i.to_i}.sort

k -= 1
f_idx = k / n
s_idx = k % n

fl = numbers.index(numbers[f_idx])
fr = numbers.rindex(numbers[f_idx])

if not fl == fr
  rem = k - fl * n
  s_idx = rem / (fr - fl + 1)
end

puts [numbers[f_idx], numbers[s_idx]].join(" ")


from collections import *

n, k = map(int, raw_input().split())
d = defaultdict(int)
a = sorted(map(int, raw_input().split()))
for x in a:
    d[x] += 1
s = sorted(d.items())

for x, y in s:
    if k <= y * n:
        print x, a[(k - 1) / y]
        break
    k -= y * n


n,k=map(int,raw_input().split())
a=map(int,raw_input().split())
a.sort()
c=[0]*len(a)
m=0
i=j=0
while i<n:
  while j<n and a[i]==a[j]: j+=1
  a[m]=a[i]
  c[m]=j-i
  m+=1
  i=j
k-=1
u=0
while k>=c[u]*n:
  k-=c[u]*n
  u+=1
v=0
while k>=c[v]*c[u]:
  k-=c[v]*c[u]
  v+=1
print a[u],a[v]


import sys
import traceback

def solve():
    n,p = map( int, sys.stdin.readline().strip('\n\r ').split())
    p -= 1
    vs = map( int, sys.stdin.readline().strip('\n\r ').split())
    lenvs = len(vs)
    vs.sort()
    return ( vs[p / lenvs ], vs[p % lenvs] )

if __name__=="__main__":
  print( "%d %d" % solve() )


import sys
import traceback

def solve():
    n,p = map( int, sys.stdin.readline().strip('\n\r ').split())
    p -= 1
    vs = map( int, sys.stdin.readline().strip('\n\r ').split())
    lenvs = len(vs)
    vs.sort()
    if n==1: return ( vs[p / lenvs ], vs[p % lenvs] )
    prow = p / lenvs
    vrow = vs[prow]
    if prow==0 and vrow<vs[prow+1]: return ( vs[p / lenvs ], vs[p % lenvs] )
    if (prow+1)==n and vrow>vs[prow-1]: return ( vs[p / lenvs ], vs[p % lenvs] )
    if n>2 and prow<(n-1) and prow>0 and vrow>vs[prow-1] and vrow<vs[prow+1]: return ( vs[p / lenvs ], vs[p % lenvs] )

    prow0 = prow
    while prow0>0:
      if vs[prow0-1]<vrow: break
      prow0 -= 1

    prow1 = prow+1
    while prow1<n:
      if vs[prow1]>vrow: break
      prow1 += 1

    dprow10 = prow1 - prow0
    ###sys.stdout.write( str((prow0,prow1,dprow10,)) )
    p -= (prow0 * lenvs)

    pcol = 0
    while p >= dprow10:
      pcol += 1
      p -= dprow10
    return( vrow, vs[pcol] )

if __name__=="__main__":
  print( "%d %d" % solve() )


n, k = map(int, raw_input().split())
a = map(int ,raw_input().split())
a.sort()
same = [1] * n
for i in xrange(n):
    if i > 0 and a[i] == a[i-1]:
        same[i] = same[i-1] + 1
    else:
        same[i] = 1
p1 = (k - 1) / n
cnt1 = same[p1]
p11 = p1 + 1
while p11 < n and a[p11] == a[p1]:
    p11 += 1
    cnt1 += 1
p0 = p11 - cnt1
p2 = (k - n*p0 - 1)/cnt1
print a[p1], a[p2]


n, k = map(int, raw_input().split())
a = map(int, raw_input().split())
d = dict()
k -= 1
for i in a:
    d[i] = d.get(i, 0) + 1
b = d.items()
b.sort()
c = 1
for x in b:
    if 0 <= k < n * x[1]:
        print x[0],
        c = x[1]
        break
    else:
        k -= n * x[1]
for x in b:
    if 0 <= k < c * x[1]:
        print x[0]
        break
    else:
        k -= c * x[1]


n, k = map(int, raw_input().split())
a = map(int, raw_input().split())
a.sort()
k -= 1
print a[k/n], a[k%n]


from __future__ import division
from bisect import bisect_left, bisect_right

n, k = map(int, raw_input().split())
k -= 1
a = map(int, raw_input().split())
a.sort()

i1 = k // n

left = bisect_left(a, a[i1])
right = bisect_right(a, a[i1])

cnt = left
num = right - left

i2 = (k - n * cnt) // num

print "%d %d" % (a[i1], a[i2])


n, k = map(int, raw_input().split())
p = map(int, raw_input().split())

k -= 1
p.sort()
a = k / n
count = p.count(p[a])
i = 0
while i < n and p[i] < p[a]:
    i += 1
k -= i * n
print p[a], p[k / count]


n, k = map(int, raw_input().split())
p = map(int, raw_input().split())

k -= 1
a = k / n
b = k - n * a
p.sort()
print p[a], p[b]


def init():
    n, k = map(int, raw_input().split())
    a = map(int, raw_input().split())
    a.sort()
    return n, k, a

def solve(n, k, a):
    p = (k - 1) / n
    k -= p * n
    tc = 0
    for i in xrange(0, n):
        if a[i] == a[p]:
            tc = tc + 1
    q = (k - 1) / tc
    return [a[p], a[q]]

if __name__ == "__main__":
    n, k, a = init()
    pair = solve(n, k, a)
    print pair[0], pair[1]


def init():
    n, k = map(int, raw_input().split())
    a = map(int, raw_input().split())
    a.sort()
    return n, k, a

def solve(n, k, a):
    p = (k - 1) / n
    tc = 0
    lc = 0
    for i in xrange(0, n):
        if a[i] == a[p]:
            tc = tc + 1
        elif a[i] < a[p]:
            lc = lc + 1
    k = k - n * lc
    q = (k - 1) / tc
    return [a[p], a[q]]

if __name__ == "__main__":
    n, k, a = init()
    pair = solve(n, k, a)
    print pair[0], pair[1]


import itertools

k = int(raw_input().split()[1])
arr = list(int(value) for value in raw_input().split())
arr = list(itertools.product(arr, arr))
arr.sort()
print arr[k - 1][0], arr[k - 1][1]


import itertools

s = raw_input()
k = int(s.split()[1])
s = raw_input()
arr = list(int(value) for value in s.split())
pairs = list(itertools.product(arr, arr))
pairs.sort()
pair = pairs[k - 1]
print pair[0], pair [1]


import itertools

s = raw_input()
k = int(s.split()[1])
s = raw_input()
arr = list(int(value) for value in s.split())
arr.sort()
pairs = list(itertools.product(arr, arr))
pair = pairs[k - 1]
print pair[0], pair [1]


s = raw_input().split()
n = int(s[0])
k = int(s[1])
arr = list(int(value) for value in raw_input().split())
arr.sort()
k -= 1
spec = arr[k / n]
num = arr.count(spec)
cnt = 0
for a in arr:
    if a < spec:
        cnt += 1
first = spec
second = arr[(k - n * cnt) / num]
print first, second


import itertools

s = raw_input()
k = int(s.split()[1])
s = raw_input()
arr = list(int(value) for value in s.split())
arr = list(itertools.product(arr, arr))
arr.sort()
print arr[k - 1][0], arr[k - 1][1]


import itertools

s = raw_input().split()
n = int(s[0])
k = int(s[1])
arr = list(int(value) for value in raw_input().split())
num = arr.count(arr[(k // n) - 2])
cnt = 0
for a in arr:
    if a < arr[(k // n) - 2]:
        cnt += 1
print arr[(k // n) - 2], arr[((k - n * cnt) // num) - 2]


#!/usr/bin/env python

import sys
import pdb

n,k = [int(i) for i in raw_input().strip().split()]

b = sorted(map(int, raw_input().split()))

z = b[(k-1)/n]

c=0
for i in b:
	if i < z:
		c += 1

x = b.count(z)
print ("%d %d" % (z, b[(k-n*c-1)/x]))


#!/usr/bin/env python

import sys
import pdb

def cmp(a,b):
	if a[0] < b[0]:
		return -1
	if a[0] == b[0] and a[1] < b[1]:
		return -1
	return 0

n,k = [int(i) for i in raw_input().strip().split(' ')]

b = list(raw_input().strip().split(' '))

d = [0]*(n*n)

for i in xrange(n):
	for j in xrange(n):
		d[i*n+j] = (b[i], b[j])

d.sort(cmp)

print ("%c %c" % (d[k-1][0], d[k-1][1]))


import sys
case = int(input())

for i in range (0,case):
    length_n = int(input())
    num_list = []
    for j in range(0,length_n):
        num_list.append(length_n)
    print(num_list)


for _ in range(int(input())):
    n = int(input())
    *x = [1]*n
    print(*x)


for _ in range(int(input())):
    n = int(input())
    for i in range(n):
        print(1)


for _ in range(int(input())):
    n = int(input())
    l = [1]*n
    print(*l)


for _ in range(int(input())):
    n = int(input())
    for i in range(n):
        print(1, end=' ')


n = int(input())
for i in range(n):
	t = int(input())
	a = [1]
	for j in range(1,t):
		a.append(a[-1]*2 + 1)
	print(*a,sep = " ")


n = int(input())
for i in range(n):
	t = int(input())
	a = [1]
	for j in range(2,t):
		a.append(a[-1]*2 + 1)
	print(*a,sep = " ")


n = int(input())
for i in range(n):
	t = int(input())
	a = []
	b = -1
	for j in range(t):
		if j %3 == 0:
			b += 2
		a.append(b)
	print(*a,sep = " ")


n = int(input())
for i in range(n):
	t = int(input())
	a = [1,1]
	for j in range(2,t):
		if j %2 == 0:
			a.append(a[-1]*2 + 1)
		else:
			a.append(a[-1])
	print(*a,sep = " ")


n = int(input())
for i in range(n):
	t = int(input())
	a = [1,2]
	for j in range(2,t):
		a.append(a[-1]+a[-2] + 1)
	print(*a,sep = " ")


t=int(input())
for i in range(t):
    n=int(input())
    for i in range(n):
        if n<1000:
            print(1,end="")
    print()


t=int(input())
for i in range(t):
    n=int(input())
    for i in range(n):
        if n<1000:
            print(1,end=" ")


t=int(input())
for i in range(t):
    n=int(input())
    for i in range(n):
        if n<1000:
            print(1,end=" ")
    print()


t=int(input())
for i in range(t):
    n=int(input())
    for i in range(n):
        if n<=1000:
            print(1,end="")
    print()


t=int(input())
for i in range(t):
    n=int(input())
    for i in range(n):
        if n<=1000:
            print(1,end=" ")


t=int(input())
for i in range(t):
    n=int(input())
    for i in range(n):
        if n<=1000:
            print(1,end=" ")
    print()


t = int(input())
for i in range(t) :
    n = int(input())
    a = list(int)
    for x,y,z in range(n) :
        a[x] + a[y] != a[z]
        sum(a) <= 1000
    print(a)


t = int(input())
for _ in range(t) :
    n = list(map(int,input().split()))
    for a in range(n) :
        for i,j,k in range(a) :
            a[i] + a[j] != a[k]
            sum(a) <= 1000
    print(a)


t = int(input())
for i in range(t) :
    n = int(input())
    print("1 " * n)


t = int(input())
for i in range(t) :
    n = int(input())
    print("1" * n)


# include<stdio.h>
int main(void)
{
    int t,n,i,j,d=1;
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {
        scanf("%d",&n);
        for(j=0;j<n;j++)
        {
            printf("%d ",d);
        }
        printf("\n");
    }
    return 0;
}


for _ in range(int(input())):
    d=1
    for i in range(int(input())):
        print(d , end=" ")


for _ in range(int(input())):
    n=int(input())
    d=1
    for i in range(n):
        print(d,end=' ')
    print()


for _ in range(int(input())):
    d=1
    for i in range(int(input())):
        print(d)


for _ in range(int(input())):
    d=1
    for i in range(int(input())):
        print(d , end=" ")
    print("\n")


# include<stdio.h>
int main()
{
    int t,n,i,j,d=1;
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {
        scanf("%d",&n);
        for(j=0;j<n;j++)
        {
            printf("%d ",d);
        }
        printf("\n");
    }
    return 0;
}


for i in range(int(input())):
    n=int(input())
    for i in range(n,0,-1):
        print(1,end=" ")
    print()


for i in range(int(input())):
    n=int(input())
    for i in range(n,0,-1):
        print(i,end=" ")
    print()


for i in range(int(input())):
    n=int(input())
    for i in range(n,0,-1):
        print(pow(2,i),end=" ")
    print()


import os
import sys
from io import BytesIO, IOBase

def main():
    pass

# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

def test():
    n = int(input())
    r = [1] * n
    print(*r)

t = int(input())
for _ in range(t):
    test()


import os
import sys
from io import BytesIO, IOBase

def main():
    pass

# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

def test():
    n = int(input())
    r = [1, 3]
    p = 0
    for i in range(5, 1000):
        if r[p] + r[p+1] < i:
            r.append(i)
            p += 1
        if p > n - 3:
            break
    print(*r)

t = int(input())
for _ in range(t):
    test()


import os
import sys
from io import BytesIO, IOBase

def main():
    pass

# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

def test():
    n = int(input())
    r = [1, 3]
    p = 0
    for i in range(5, 1000):
        if r[p] + r[p+1] != i:
            r.append(i)
            p += 1
        if p > n - 3:
            break
    print(*r)

t = int(input())
for _ in range(t):
    test()


import os
import sys
from io import BytesIO, IOBase

def main():
    pass

# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

def test():
    n = int(input())
    r = [1, 2]
    p = 0
    for i in range(4, 1000):
        if r[p] + r[p+1] != i:
            r.append(i)
            p += 1
        if p > n - 3:
            break
    print(*r)

t = int(input())
for _ in range(t):
    test()


c = int(input())
for x in range(c):
    l = int(input())
    print([1 for x in range(l)])


c = int(input())
for x in range(c):
    l = int(input())
    print(' '.join(['1' for x in range(l)]))


c = int(input())
for x in range(c):
    l = int(input())
    print(' '.join([str(2*x+1) for x in range(l)]))


c = int(input())
for x in range(c):
    l = int(input())
    print([(2*x+1) for x in range(l)])


for _ in range(int(input())):
    n=int(input())
    l=[1,2]
    c=0
    z=3
    m=0
    if n>2:
        while len(l)!=n:
            if l[c]+l[c+1]!=z:
                l.append(z)
                c+=1
                if m==1:
                    m=0
                    z=t-1
            else:
                k=z
                t=k
                m+=1
            z+=1
    if n==1:
        print(l[0])
    elif n==2:
        print(*l[0:2])
    elif n>2:
        print(*l)


for _ in range(int(input())):
    n=int(input())
    l=[1 for i in range(n)]
    print(*l)


for _ in range(int(input())):
    n=int(input())
    l=[1,2]
    c=0
    z=3
    if n>2:
        while len(l)!=n:
            if l[c]+l[c+1]!=z:
                l.append(z)
                c+=1
            z+=1
    if n==1:
        print(l[0])
    elif n==2:
        print(*l[0:2])
    elif n>2:
        print(*l)


for _ in range(int(input())):
    n=int(input())
    l=[1,2]
    c=0
    z=3
    m=0
    if n>2:
        while len(l)!=n:
            if l[c]+l[c+1]!=z:
                l.append(z)
                c+=1
                if m==1:
                    m=0
                    z=t-1
            else:
                k=z
                t=k
                m+=1
            z+=1
            if z>=3:
                z=1
    if n==1:
        print(l[0])
    elif n==2:
        print(*l[0:2])
    elif n>2:
        print(*l)
        print(sum(l))


for _ in range(int(input())):
    n=int(input())
    l=[1,2]
    c=0
    z=3
    if n>2:
        while len(l)!=n:
            if l[c]+l[c+1]!=z:
                l.append(z)
                c+=1
            z+=1
    print(*l)


t = int(input())
for u in range(t):
    n = int(input())
    a = [1 for i in range(n)]

    print(*a)


t = int(input())
for u in range(t):
    n = int(input())
    a = []
    i = 0
    k = 1
    while i < n:

        a.append(k)
        if i % 2 == 0:
            k += 2

        i += 1
    print(*a)


t = int(input())
for u in range(t):
    n = int(input())
    a = []
    i = 0
    k = 1
    while i < n:

        a.append(k)

        k += 2
        i += 1
    print(a)


t = int(input())
for u in range(t):
    n = int(input())
    a = []
    i = 0
    k = 1
    while i < n:

        a.append(k)
        if i % 2 == 0:
            k += 2
        i += 1
    print(a)


for _ in range(int(input())):
    n=int(input())
    for i in range(n):
        print(1,end=" ")


for _ in range(int(input())):
    n=int(input())
    for i in range(n):
        print(1,end=" ")
    print("")


for _ in range(int(input())):
    n=int(input())
    for i in range(0,n):
        print(2*int(i/2)+1,end=" ")


for _ in range(int(input())):
    n=int(input())
    for i in range(n):
        print(2*i+1,end=" ")


# -*- coding: utf-8 -*-
"""
Created on Mon Jul 27 19:54:06 2020

@author: Admin
"""

for _ in range(int(input())):
    for i in range(1,int(input())+1):
        print(i*2-1, end=' ')
    print()


for _ in range(int(input())):
    arr=[]
    for i in range(1,int(input())+1):
        print(i*2-1, end=' ')


for _ in range(int(input())):
    arr=[]
    for i in range(1,int(input())+1):
        arr.append(i*2-1)
    print(arr)


for _ in range(int(input())):
    for i in range(1, int(input())+1):
        print(i*2-1, end=' ')
    print('\n')


for _ in range(int(input())):
    for i in range(int(input())):
        print(1, end=' ')
    print()


for _ in range(int(input())):
    arr=[]
    for i in range(1,int(input())+1):
        print(i*2-1, end=' ')
    print(/n)


for i in range(int(input())):
    n = int(input())
    a = []
    for i in range(1000):
        if(i%2 != 0):
            a.append(i)
        if(len(a) == n):
            break
    print(*a)


for i in range(int(input())):
    n = int(input())
    a = []
    for i in range(1000):
        if(i%2 != 0):
            a.append(i)
        if(len(a) == n):
            break
    if(len(a) < n):
        for i in range(n-len(a)):
            a.append(1)
    print(*a)


for i in range(int(input())):
    n = int(input())
    a = []
    for i in range(n):
        a.append(1)
    print(*a)


for i in range(int(input())):
    n = int(input())
    a = []
    for i in range(1000):
        if(i%2 != 0):
            a.append(i)
    print(*a)


for _ in range(int(input())):
	n=int(input())
	i=1
	for _ in range(n):
	    print(i%1000,end=" ")
	    i+=1
	print("\n")


for _ in range(int(input())):
	n=int(input())
	i=1
	for _ in range(n):
	    print(i%1000,end="")
	    i+=1


for _ in range(int(input())):
	n=int(input())
	i=1
	for _ in range(n):
	    print(i%1000)
	    i+=5
        print("\n")


for _ in range(int(input())):
	n=int(input())
    for i in range(1,n,2):
         print(i%1000,end="")


for _ in range(int(input())):
	n=int(input())
	i=1
	for _ in range(n):
	    print(i%1000,end=" ")
	    i+=1


for _ in range(int(input())):
	n=int(input())
	i=1
	for _ in range(n):
	    print(i%1000)
	    i+=5


for nt in range(int(input())):
	n = int(input())
	print (*([1]*n))


import random

for _ in range(int(input())):

	n=int(input())

        a=[]

    	for i in range(n):

             a.append(random.randrange(1, 1000, 1))

	print(a)


import random
for _ in range(int(input())):
    n=int(input())
    a=[]
    for i in range(n):
        a.append(random.randrange(1, 1000, 1))
    print(a)


for _ in range(int(input()):
    n=int(input())
    for i in range(1,n,2):
        print(i%1000,end="")


T=int(input())
for t in range(T):
    N = int(input())
    a = []
    for i in range(N):
        a.append(str(1000-i))
    print(' '.join(a))


T=int(input())
for t in range(T):
    N = int(input())
    a = []
    for i in range(N):
        a.append(str(1000))
    print(' '.join(a))


T=int(input())
for t in range(T):
    N = int(input())
    for i in range(N):
        print(1000-i)


T=int(input())
for t in range(T):
    N = int(input())
    a = []
    for i in range(N):
        a.append(1000-i)
    print(' '.join(a))


T=int(input())
for t in range(T):
    N = int(input())
    a = []
    for i in range(N):
        a.append(1000-i)
    print(a)


t=int(input())
for i in range (t):
    n=int(input())
    for j in range(n):
        print("1 ",end="")


t=int(input())
for i in range (t):
    n=int(input())
    for j in range(n):
        print("1 ",end="")
    print("\n")


t=int(input())
for i in range (t):
    n=int(input())
    for j in range(n):
        print("1 ",end="")
    print("")


# def omkar(arr,n):
#     # print(arr,n)
#     maximum=0
#     i=0
#     while i < n-2:
#         last=arr[-1]
#         s_last = arr[-2]
#         maximum = last + s_last
#         new=maximum+1
#         arr.append(new)
#         i+=1
    # return arr

for _ in range(int(input())):
    n= int(input())
    # arr=[]
    # arr.append(1)
    # arr.append(2)
    # li=omkar(arr,n)
    # for i in li:
    #     print(i,end=' ')
    # print()
    i=0
    while i<n:
        print(n,end=" ")
        i+=1
    print()


def omkar(arr,n):
    # print(arr,n)
    maximum=0
    i=0
    while i < n-2:
        last=arr[-1]
        s_last = arr[-2]
        maximum = last + s_last
        new=maximum+1
        arr.append(new)
        i+=1
    return arr

for _ in range(int(input())):
    n= int(input())
    arr=[]
    arr.append(1)
    arr.append(2)
    li=omkar(arr,n)
    for i in li:
        print(i,end=' ')
    print()


# def omkar(arr,n):
#     # print(arr,n)
#     maximum=0
#     i=0
#     while i < n-2:
#         last=arr[-1]
#         s_last = arr[-2]
#         maximum = last + s_last
#         new=maximum+1
#         arr.append(new)
#         i+=1
    return arr

for _ in range(int(input())):
    n= int(input())
    # arr=[]
    # arr.append(1)
    # arr.append(2)
    # li=omkar(arr,n)
    # for i in li:
    #     print(i,end=' ')
    # print()
    i=0
    while i<n:
        print(n,end=" ")
        i+=1
    print()


def omkar(arr,n):
    # print(arr,n)
    maximum=0
    i=0
    while i < n-2:
        last=arr[-1]
        s_last = arr[-2]
        maximum = last + s_last
        new=maximum+1
        arr.append(new)
        i+=1
    return arr

for _ in range(int(input())):
    n= int(input())
    arr=[]
    arr.append(1)
    arr.append(2)
    li=omkar(arr,n)
    for i in li:
        print(i,end=' ')


t = int(input())
for i in range(t):
    n = int(input())
    if n==1:
        print([1])
    elif n==2:
        print([1,1])
    else:
        print([1]*n)


t = int(input())
for i in range(t):
    n = int(input())
    print([1]*n)


t = int(input())
for i in range(t):
    n = int(input())
    for j in range(n):
        print(1,end = " ")
    print()


t = int(input())
for i in range(t):
    n = int(input())
    if n==1:
        print([1])
    elif n==2:
        print([1,2])
    else:
        arr = [1,2]
        curr_sum = 3
        for j in range(n-2):
            curr_sum+=1
            arr.append(curr_sum)
            curr_sum+=curr_sum-1
        print(arr)


def main():
    n = int(input())

    for i in range(n):
        s = int(input())

        for j in range(s):
            print(2, end=" ")

main()


def main():
    n = int(input())

    for i in range(n):
        s = int(input())

        for j in range(s):
            print(2, end=" ")

        print()

main()


def main():
    n = int(input())

    for i in range(n):
        s = int(input())

        for j in range(s):
            print(2)

main()


for t in range(int(input())):
    n=int(input())
    # l=list(map(int,input().split()))
    for i in range(n):
        print(n-i,end="")
    print()


for t in range(int(input())):
    n=int(input())
    # l=list(map(int,input().split()))
    l=[5]*n
    print(*l)


for t in range(int(input())):
    n=int(input())
    # l=list(map(int,input().split()))
    for i in range(n):
        print(n,end="")
    print()


for t in range(int(input())):
    n=int(input())
    # l=list(map(int,input().split()))
    for i in range(n):
        print(n-i,end=" ")
    print()


test = int(input())
t = 0
while t < test:
    want = []
    n = int(input())
    for array in range(n):
        want.append(str(1))
    print(' '.join(want))
    t = t + 1


test = int(input())
t = 0

while t < test:
    n = int(input())
    for array in range(1, 2*n, 2):
        b=str(array)
        print(b+' ', end='')
    t = t + 1
    print('\n')


test = int(input())
t = 0
while t < test:
    want = []
    n = int(input())
    for array in range(1, 2*n, 2):
        want.append(str(array))
    print(' '.join(want))
    t = t + 1


# -*- coding: utf-8 -*-
"""
Created on Fri Jul 17 19:40:00 2020

@author: shubham gupta
"""
for _ in range(int(input())):
    print(' '.join(['1']*(int(input()))))


# import all important libraries and inbuilt functions
from __future__ import division, print_function
from fractions import Fraction
import numpy as np
import sys,bisect,copyreg,statistics,os,time,socket,socketserver
from math import *
from collections import Counter,defaultdict,deque,OrderedDict
from itertools import combinations,permutations,accumulate,groupby
from numpy.linalg import matrix_power as mp
from bisect import bisect_left,bisect_right,bisect,insort,insort_left,insort_right
from statistics import mode
from copy import copy
from functools import reduce,cmp_to_key
from io import BytesIO, IOBase
from scipy.spatial import ConvexHull
from heapq import *
from decimal import *
from queue import Queue,PriorityQueue
from re import sub,subn
from random import shuffle,randrange,randint,random

# end of library import

# map system version faults
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

# template of many functions used in competitive programming can add more later
# based on need we will use this commonly.

# bfs in a graph
def bfs(adj,v): # a schema of bfs
    visited=[False]*(v+1);q=deque()
    while q:pass

# definition of vertex of a graph
def graph(vertex): return [[] for i in range(vertex+1)]

def powermodulo(x, y, p) :
    res = 1;x = x % p
    if (x == 0) : return 0
    while (y > 0) :
        if ((y & 1) == 1) :   res = (res * x) % p
        y = y >> 1
        x = (x * x) % p
    return res

def lcm(a,b): return (a*b)//gcd(a,b)

# most common list in a array of lists
def most_frequent(List):return Counter(List).most_common(1)[0][0]

# element with highest frequency
def most_common(List):return(mode(List))

#In number theory, the Chinese remainder theorem states that
#if one knows the remainders of the Euclidean division of an integer n by
#several integers, then one can determine uniquely the remainder of the
#division of n by the product of these integers, under the condition
#that the divisors are pairwise coprime.
def chinese_remainder(a, p):
    prod = reduce(op.mul, p, 1);x = [prod // pi for pi in p]
    return sum(a[i] * powermodulo(x[i], p[i] - 2, p[i]) * x[i] for i in range(len(a))) % prod

# make a matrix
def createMatrix(rowCount, colCount, dataList):
    mat = []
    for i in range (rowCount):
        rowList = []
        for j in range (colCount):
            if dataList[j] not in mat:rowList.append(dataList[j])
        mat.append(rowList)
    return mat

# input for a binary tree
def readTree():
    v=int(inp());adj=[set() for i in range(v+1)]
    for i in range(v-1):u1,u2=In(); adj[u1].add(u2);adj[u2].add(u1)
    return adj,v

# sieve of prime numbers
def sieve():
    li=[True]*1000001;li[0],li[1]=False,False;prime=[]
    for i in range(2,len(li),1):
        if li[i]==True:
            for j in range(i*i,len(li),i):li[j]=False
    for i in range(1000001):
        if li[i]==True:prime.append(i)
    return prime

#count setbits of a number.
def setBit(n):
    count=0
    while n!=0:n=n&(n-1);count+=1
    return count

# sum of digits of a number
def digitsSum(n):
    if n == 0:return 0
    r = 0
    while n > 0:r += n % 10;n //= 10
    return r

# ncr efficiently
def ncr(n, r):
    r = min(r, n - r);numer = reduce(op.mul, range(n, n - r, -1), 1);denom = reduce(op.mul, range(1, r + 1), 1)
    return numer // denom  # or / in Python 2

#factors of a number
def factors(n):return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))

#prime fators of a number
def prime_factors(n):
    i = 2;factors = []
    while i * i <= n:
        if n % i:i += 1
        else:n //= i;factors.append(i)
    if n > 1:factors.append(n)
    return set(factors)

def prefixSum(arr):
    for i in range(1, len(arr)):arr[i] = arr[i] + arr[i-1]
    return arr

def binomial_coefficient(n, k):
    if 0 <= k <= n:
        ntok = 1;ktok = 1
        for t in range(1, min(k, n - k) + 1):ntok *= n;ktok *= t;n -= 1
        return ntok // ktok
    else:return 0

def powerOfK(k, max):
    if k == 1:return [1]
    if k == -1:return [-1, 1]
    result = [];n = 1
    while n <= max:result.append(n);n *= k
    return result

# maximum subarray sum use kadane's algorithm
def kadane(a,size):
    max_so_far = 0;max_ending_here = 0
    for i in range(0, size):
        max_ending_here = max_ending_here + a[i]
        if (max_so_far < max_ending_here):max_so_far = max_ending_here
        if max_ending_here < 0:max_ending_here = 0
    return max_so_far

def divisors(n):
    result = []
    for i in range(1,ceil(sqrt(n))+1):
        if n%i == 0:
            if n/i == i:result.append(i)
            else:result.append(i);result.append(n/i)
    return result

def sumtilln(n): return ((n*(n+1))//2)

def isPrime(n) :
	if (n <= 1) :return False
	if (n <= 3) :return True
	if (n % 2 == 0 or n % 3 == 0) :return False
	for i in range(5,ceil(sqrt(n))+1,6):
		if (n % i == 0 or n % (i + 2) == 0) :return False
	return True

def isPowerOf2(n):
    while n % 2 == 0:n //= 2
    return (True if n == 1 else False)

def power2(n):
    k = 0
    while n % 2 == 0:k += 1;n //= 2
    return k

def sqsum(n):return ((n*(n+1))*(2*n+1)//6)

def cusum(n):return ((sumn(n))**2)

def pa(a):
    for i in range(len(a)):print(a[i], end = " ")
    print()

def pm(a,rown,coln):
    for i in range(rown):
        for j in range(coln):print(a[i][j],end = " ")
        print()

def pmasstring(a,rown,coln):
    for i in range(rown):
        for j in range(coln):print(a[i][j],end = "")
        print()

def isPerfectSquare(n):return pow(floor(sqrt(n)),2) == n

def nC2(n,m):return (((n*(n-1))//2) % m)

def modInverse(n,p):return powermodulo(n,p-2,p)

def ncrmodp(n, r, p):
	num = den = 1
	for i in range(r):num = (num * (n - i)) % p ;den = (den * (i + 1)) % p
	return (num * powermodulo(den,p - 2, p)) % p

def reverse(string):return "".join(reversed(string))

def listtostr(s):return ' '.join([str(elem) for elem in s])

def binarySearch(arr, l, r, x):
	while l <= r:
		mid = l + (r - l) // 2;
		if arr[mid] == x:return mid
		elif arr[mid] < x:l = mid + 1
		else:r = mid - 1
	return -1

def isarrayodd(a):
    r = True
    for i in range(len(a)):
        if a[i] % 2 == 0:
            r = False
            break
    return r

def isPalindrome(s):return s == s[::-1]

def gt(x,h,c,t):return ((x*h+(x-1)*c)/(2*x-1))

def CountFrequency(my_list):
    freq = {}
    for item in my_list:freq[item] = (freq[item] + 1 if (item in freq) else 1)
    return freq

def CountFrequencyasPair(my_list1,my_list2,freq):
    for item in my_list1:freq[item][0] = (freq[item][0] + 1 if (item in freq) else 1)
    for item in my_list2:freq[item][1] = (freq[item][1] + 1 if (item in freq) else 1)
    return freq

def binarySearchCount(arr, n, key):
    left = 0;right = n - 1;count = 0
    while (left <= right):
        mid = int((right + left) / 2)
        if (arr[mid] <= key):count,left = mid + 1,mid + 1
        else:right = mid - 1
    return count

def primes(n):
  sieve,l = [True] * (n+1),[]
  for p in range(2, n+1):
    if (sieve[p]):
      l.append(p)
      for i in range(p, n+1, p):sieve[i] = False
  return l

def Next_Greater_Element_for_all_in_array(arr):
	s,n,reta,retb = list(),len(arr),[],[];arr1 = [list([0,i]) for i in range(n)]
	for i in range(n - 1, -1, -1):
		while (len(s) > 0 and s[-1][0] <= arr[i]):s.pop()
		if (len(s) == 0):arr1[i][0] = -1
		else:arr1[i][0] = s[-1]
		s.append(list([arr[i],i]))
	for i in range(n):reta.append(list([arr[i],i]));retb.append(arr1[i][0])
	return reta,retb

def polygonArea(X,Y,n):
    area = 0.0;j = n - 1
    for i in range(n):area += (X[j] + X[i]) * (Y[j] - Y[i]);j = i
    return abs(area / 2.0)

def merge(a, b):
	ans = defaultdict(int)
	for i in a:ans[i] += a[i]
	for i in b:ans[i] += b[i]
	return ans

# Print the all possible subset sums that lie in a particular interval of l <= sum <= target
def subset_sum(numbers,l,target, partial=[]):
    s = sum(partial)
    if l <= s <= target:print ("sum(%s)=%s" % (partial, s))
    if s >= target:return
    for i in range(len(numbers)):subset_sum(numbers[i+1:], l,target, partial + [numbers[i]])

#defining a LRU Cache
# where we can set values and get values based on our requirement
class LRUCache:
	# initialising capacity
	def __init__(self, capacity: int):
		self.cache = OrderedDict()
		self.capacity = capacity

	# we return the value of the key
	# that is queried in O(1) and return -1 if we
	# don't find the key in out dict / cache.
	# And also move the key to the end
	# to show that it was recently used.
	def get(self, key: int) -> int:
		if key not in self.cache:return -1
		else:self.cache.move_to_end(key);return self.cache[key]

	# first, we add / update the key by conventional methods.
	# And also move the key to the end to show that it was recently used.
	# But here we will also check whether the length of our
	# ordered dictionary has exceeded our capacity,
	# If so we remove the first key (least recently used)
	def put(self, key: int, value: int) -> None:
		self.cache[key] = value;self.cache.move_to_end(key)
		if len(self.cache) > self.capacity:self.cache.popitem(last = False)

class segtree:
    def __init__(self,n):
        self.m = 1
        while self.m < n:self.m *= 2
        self.data = [0] * (2 * self.m)
    def __setitem__(self,i,x):
        x = +(x != 1);i += self.m;self.data[i] = x;i >>= 1
        while i:self.data[i] = self.data[2 * i] + self.data[2 * i + 1];i >>= 1
    def __call__(self,l,r):
        l += self.m;r += self.m;s = 0
        while l < r:
            if l & 1:s += self.data[l];l += 1
            if r & 1:r -= 1;s += self.data[r]
            l >>= 1;r >>= 1
        return s

class FenwickTree:
  def __init__(self, n):self.n = n;self.bit = [0]*(n+1)
  def update(self, x, d):
    while x <= self.n:self.bit[x] += d;x += (x & (-x))
  def query(self, x):
    res = 0
    while x > 0:res += self.bit[x];x -= (x & (-x))
    return res
  def range_query(self, l, r):return self.query(r) - self.query(l-1)
# can add more template functions here

# end of template functions

# To enable the file I/O i the below 2 lines are uncommented.
# read from in.txt if uncommented
if os.path.exists('in.txt'): sys.stdin=open('in.txt','r')
# will print on Console if file I/O is not activated
#if os.path.exists('out.txt'): sys.stdout=open('out.txt', 'w')

# inputs template
#for fast input we areusing sys.stdin
def inp(): return sys.stdin.readline().strip()

#for fast output, always take string
def out(var): sys.stdout.write(str(var))

# custom base input needed for the program
def I():return (inp())
def II():return (int(inp()))
def FI():return (float(inp()))
def SI():return (list(str(inp())))
def MI():return (map(int,inp().split()))
def LI():return (list(MI()))
def SLI():return (sorted(LI()))
def MF():return (map(float,inp().split()))
def LF():return (list(MF()))
def SLF():return (sorted(LF()))

# end of inputs template

# common modulo values used in competitive programming
MOD = 998244353
mod = 10**9+7

# any particular user-defined functions for the code.
# can be written here.

# end of any user-defined functions

# main functions for execution of the program.
if __name__ == '__main__':
    # execute your program from here.
    # start your main code from here

    # Write your code here
    for _ in range(II()):
        pa([1]*(II()))

    # end of main code
    # end of program

# This program is written by :
#   Shubham Gupta
#   B.Tech (2019-2023)
#   Computer Science and Engineering,
#   Department of EECS
#   Contact No:8431624358
#   Indian Institute of Technology(IIT),Bhilai
#   Sejbahar,
#   Datrenga,
#   Raipur,
#   Chhattisgarh
#   492015

#   THANK YOU FOR
#YOUR KIND PATIENCE FOR READING THE PROGRAM.


for _ in range(int(input())):
    n = int(input())
    for i in range(n):
        print(1,end = " ")
    print()


# your code goes here
n = int(input())
a = list(map(int, input().split()))
a.sort()
l = []
if n == 0:
	print(0)
else:
	for i in range(n+1):
		ln = a[i+n-1]-a[i]
		if i == 0:
			breadth = a[-1]-a[n]
		elif i == n-1:
			breadth = a[n-1]-a[0]
		else:
			breadth = a[-1]-a[0]
		l.append(ln*breadth)
	print(min(l))


# your code goes here
n = int(input())
a = list(map(int, input().split()))
a.sort()
l = []
if n == 0:
	print(0)
else:
	for i in range(n):
		ln = a[i+n-1]-a[i]
		if i == 0:
			breadth = a[-1]-a[n]
		elif i == n-1:
			breadth = a[n-2]-a[0]
		else:
			breadth = a[-1]-a[0]
		l.append(ln*breadth)
	print(min(l))


# your code goes here
n = int(input())
a = list(map(int, input().split()))
a.sort()
l = []
if n == 0:
	print(0)
else:
	for i in range(n):
		ln = a[i+n-1]-a[i]
		if i == 0:
			breadth = a[-1]-a[n]
		else:
			breadth = a[-1]-a[0]
		l.append(ln*breadth)
	print(min(l))


# your code goes here
n = int(input())
a = list(map(int, input().split()))
a.sort()
l = []
if n == 0:
	print(0)
else:
	for i in range(n+1):
		ln = a[i+n-1]-a[i]
		if i == 0:
			breadth = a[-1]-a[n]
		elif i == n:
			breadth = a[n-1]-a[0]
		else:
			breadth = a[-1]-a[0]
		l.append(ln*breadth)
	print(min(l))


# your code goes here
n = int(input())
a = list(map(int, input().split()))
a.sort()
l = []
for i in range(n):
	ln = a[i+n-1]-a[i]
	if i == 0:
		breadth = a[-1]-a[n]
	elif i == n-1:
		breadth = a[n-1]-a[0]
	else:
		breadth = a[-1]-a[0]
	l.append(ln*breadth)
print(min(l))


N = gets.to_i
as = gets.split.map(&:to_i).sort

ans1 = (as[2*N-1] - as[N]) * (as[N-1] - as[0])

min = 10**9
(0..N).each do |i|
    result = as[i+N-1] - as[i]
    min = result if min > result
end
ans2 = min * (as[2*N-1] - as[0])

puts [ans1, ans2].min


n = int(raw_input())
a = sorted(map(int, raw_input().split()))

if n == 1:
  print "0"
  exit(0)

ans = 10 ** 20
for i in range(len(a) / 2):
  x1, x2 = a[i], a[i + n - 1]
  y2 = a[-1]
  y1 = a[0]
  if i == 0:
    y1 = a[n]
  ans = min(ans, abs(x1 - x2) * abs(y1 - y2))

print ans


n = int(raw_input())
a = [int(x) for x in raw_input().split()]
a.sort()
print (a[n-1]-a[0]) * (a[2*n-1]-a[n])


n = int(raw_input())
a = [int(x) for x in raw_input().split()]
a.sort()
print min([(a[i+n-1] - a[i]) * (a[2*n-1] - a[0]) for i in xrange(1,n)] + [(a[n-1]-a[0]) * (a[2*n-1] - a[n])])


n = int(raw_input())
a = [int(x) for x in raw_input().split()]
a.sort()
print min([a[i+n-1] - a[i] for i in xrange(n+1)])


n = int(raw_input())
a = [int(x) for x in raw_input().split()]
a.sort()
ans = min([(a[i+n-1] - a[i]) * (a[2*n-1] - a[0]) for i in xrange(1,n)])
print min(ans, (a[n-1]-a[0]) * (a[2*n-1] - a[n]))


def min_area(arr):
    arr.sort()
    ans = (arr[n-1]-arr[0])*(arr[2*n-1]-arr[n])
    for i in range(1,n+1):
        temp = (arr[i+n-1]-arr[i])*(arr[2*n-1]-arr[0])
        ans = min(ans,temp)
    return ans

n = input()
A = map(int, raw_input().split())
print min_area(A)


import math

# n, k = map(int, raw_input().split())
n = int(raw_input())
# n = raw_input()

coords = map(int, raw_input().split())
coords.sort()

minarea = 1000000000000000000

for i in xrange(n):
    x = coords[i+n-1] - coords[i]
    if i != 0 and i != (n-1):
        y = coords[2*n-1] - coords[0]
    elif i == 0:
        y = coords[2*n-1] - coords[n]
    else:
        y = coords[n-1] - coords[0]
    area = x*y
    # print x, y, area
    minarea = min(minarea, area)

print minarea
# print ans


import math

# n, k = map(int, raw_input().split())
n = int(raw_input())
# n = raw_input()

coords = map(int, raw_input().split())
coords.sort()
# print coords
minarea = 1000000000000000000

for i in xrange(n):
    x = coords[i+n-1] - coords[i]
    if i != 0:
        y = coords[2*n-1] - coords[0]
    elif i == 0:
        y = coords[2*n-1] - coords[n]

    area = x*y
    # print x, y, area
    minarea = min(minarea, area)

print minarea
# print ans


n = int(raw_input())
a = sorted(map(int, raw_input().split()))

if n == 1:
  print "0"
  exit(0)

ans = 10 ** 20

for i in range(len(a) / 2 - 1):
  x1, x2 = a[i], a[i + n - 1]
  y2 = a[-1]
  y1 = a[0]
  if i == 0:
    y1 = a[n]
  ans = min(ans, abs(x1 - x2) * abs(y1 - y2))

print ans


n = int(raw_input())
a = sorted(map(int, raw_input().split()))

if n == 1:
  print "0"
  exit(0)

x1, x2 = 10 ** 18, 0
y1, y2 = x1, x2

for i in range(len(a) / 2):
  x1 = min(a[i], x1)
  x2 = max(a[i], x2)
  y1 = min(a[-i - 1], y1)
  y2 = max(a[-i - 1], y2)

print abs(x1 - x2) * abs(y1 - y2)


n = int(raw_input())
a = sorted(map(int, raw_input().split()))

if n == 1:
  print "0"
  exit(0)

ans = 10 ** 20
for i in range(max(len(a) / 2 - 1, 1)):
  x1, x2 = a[i], a[i + n - 1]
  y2 = a[-1]
  y1 = a[0]
  if i == 0:
    y1 = a[n]
  ans = min(ans, abs(x1 - x2) * abs(y1 - y2))

print ans


n = int(raw_input())
a = sorted(map(int, raw_input().split()))

if n == 1:
  print "0"
  exit(0)

ans = 10 ** 20
for i in range(len(a) / 2 - 1):
  x1, x2 = a[i], a[i + n - 1]
  y2 = a[-1]
  y1 = a[0]
  if i == 0:
    y1 = a[n]
  ans = min(ans, abs(x1 - x2) * abs(y1 - y2))

x1, x2 = a[0], a[n - 1]
y2 = a[-1]
y1 = n
while y1 < 2 * n and a[y1] == a[n - 1]:
  y1 += 1

print min(ans, abs(x1 - x2) * abs(y2 - a[y1]))


n = int(raw_input())
a = map(lambda x: int(x), raw_input().split(" "))
a.sort()
s = (a[n-1] - a[0])*(a[-1]-a[n])
for i in range(n):
    s = min(s, (a[-1]-a[0])*(a[i+n-1]-a[i]))
print s


n = int(raw_input())
a = map(lambda x: int(x), raw_input().split(" "))
a.sort()
print (a[n-1] - a[0])*(a[-1]-a[n])


n = int(raw_input())
a = sorted([int(x) for x in raw_input().split()])

ans = (a[n-1]-a[0]) * (a[2*n-1]-a[n])
y1 = a[0]
y2 = a[-1]
for i in range(1,n):
    x1 = a[i]
    x2 = a[i+n-1]
    ans = min(ans, (x2-x1)*(y2-y1))
print ans


n = int(raw_input())
a = map(int,raw_input().split())
a.sort()
w = a[0]
x = a[n-1]
y = a[n]
z = a[-1]
print (x-w)*(z-y)


n = int(raw_input())
a = map(int,raw_input().split())
a.sort()
w = a[0]
x = a[n-1]
y = a[n]
z = a[-1]
ans = (x-w)*(z-y)
for i in range(n+1):
	ans = min(ans,(a[-1]-a[0])*(a[n+i-1]-a[i]))
print ans


import sys

def solve(n, a):
  if n == 1:
    print('0')
    return

  l = len(a)
  min_x = 0
  min_y = 0
  max_x = 0
  max_y = 0
  a.sort()
  min_x = a[0]
  max_x = a[l/2 - 1]
  min_y = a[l/2]
  max_y = a[l-1]

  print('%d' % ((max_x - min_x) * (max_y - min_y)))

n = sys.stdin.readline()
n = int(n)

ar = sys.stdin.readline()
ar = ar.split()
ar = [int(a) for a in ar if a and len(a) > 0]

solve(n, ar)


import sys

def solve(n, a):
  if n == 1:
    print('0')
    return

  l = len(a)
  a.sort()

  least = -1
  for shift in range(0, l):
    curr = sub_solve(a, shift)
    if least == -1 or least > curr:
      least = curr

  print(least)

def sub_solve(a, s):
  l = len(a)
  min_x = a[s % l]
  max_x = a[(l/2 - 1 + s) % l]
  min_y = a[(l/2 + s) % l]
  max_y = a[(l-1 + s) % l]

  return abs(max_x - min_x) * abs(max_y - min_y)

n = sys.stdin.readline()
n = int(n)

ar = sys.stdin.readline()
ar = ar.split()
ar = [int(a) for a in ar if a and len(a) > 0]

solve(n, ar)


import sys

def solve(n, a):
  if n == 1:
    print(0)
    return
  l = len(a)
  a.sort()
  least = -1
  for shift in range(0, l):
    curr = sub_solve(a, shift)
    if least == -1 or least > curr:
      least = curr
  print(least)

def get_min(a, ind1, ind2):
  if ind1 > ind2:
    return a[0]
  return a[ind1]

def get_max(a, ind1, ind2):
  if ind1 > ind2:
    return a[len(a) - 1]
  return a[ind2]

def sub_solve(a, s):
  l = len(a)
  min_x = get_min(a, s % l, (l/2 - 1 + s) % l)
  max_x = get_max(a, s % l, (l/2 - 1 + s) % l)

  min_y = get_min(a, (l/2 + s) % l, (l-1 + s) % l)
  max_y = get_max(a, (l/2 + s) % l, (l-1 + s) % l)
  return abs(max_x - min_x) * abs(max_y - min_y)

n = sys.stdin.readline()
n = int(n)

ar = sys.stdin.readline()
ar = ar.split()
ar = [int(a) for a in ar if a and len(a) > 0]

solve(n, ar)


import sys

def solve(n, a):
  if n == 1:
    print(0)
    return
  l = len(a)
  a.sort()
  least = -1
  for shift in range(0, l):
    curr = sub_solve(a, shift)
    if least == -1 or least > curr:
      least = curr
  print(least)

def sub_solve(a, s):
  l = len(a)
  min_x = a[s % l]
  max_x = a[(l/2 - 1 + s) % l]
  min_y = a[(l/2 + s) % l]
  max_y = a[(l-1 + s) % l]
  return abs(max_x - min_x) * abs(max_y - min_y)

n = sys.stdin.readline()
n = int(n)

ar = sys.stdin.readline()
ar = ar.split()
ar = [int(a) for a in ar if a and len(a) > 0]

solve(n, ar)


n = input()
v = map(int, raw_input().split(' '))

v.sort()

print (v[n - 1] - v[0]) * (v[2 * n - 1] - v[n])


n = input()
v = map(int, raw_input().split(' '))

v.sort()

res = 10**18

for i in range(n):
	if i == 0:
		res = min(res, (v[i + n - 1] - v[i]) * (v[2 * n - 1] - v[i + n]))
	else:
		res = min(res, (v[i + n - 1] - v[i]) * (v[2 * n - 1] - v[0]))

print res


n = int(raw_input())
a = map(int, raw_input().split())
a.sort()
ans = (a[n-1] - a[0]) * (a[-1] - a[n])
c = a[-1] - a[0]
for i in xrange(1, n):
    ans = min(ans, (a[i+n-1] - a[i]) * c)
print ans


n = int(raw_input())
a = map(int, raw_input().split())
a.sort()
print (a[n-1] - a[0]) * (a[-1] - a[n])


//-------------------------------------- Header Files -------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
//---------------------------------------- Data Types -----------------------------------------------------
#define ll long long
#define ld long double

typedef struct {int x,y;}			II;
typedef struct {int x,y,z;}		III;
typedef struct {ll x,y;}			LL;
typedef struct {ll x,y,z;}		LLL;
typedef struct {int v,*nxt;}	IN;
//---------------------------------------- cmp func's -----------------------------------------------------
int inc_cmp_int(const void *a, const void *b){return *(int*)a-*(int*)b;} 										   //increasing
int inc_cmp_ll (const void *a, const void *b){return *(ll*)a==*(ll*)b?0:*(ll*)a>*(ll*)b?1:-1;} //increasing
int inc_cmp_ld (const void *a, const void *b){return *(ld*)a==*(ld*)b?0:*(ld*)a>*(ld*)b?1:-1;} //increasing
int dec_cmp_int(const void *a, const void *b){return *(int*)b-*(int*)a;} 										   //decreasing
int dec_cmp_ll (const void *a, const void *b){return *(ll*)a==*(ll*)b?0:*(ll*)b>*(ll*)a?1:-1;} //decreasing
int dec_cmp_ld (const void *a, const void *b){return *(ld*)a==*(ld*)b?0:*(ld*)b>*(ld*)a?1:-1;} //decreasing
//---------------------------------------- Personal Macros -------------------------------------------------
#define mid_arr(A) (&A[sizeof(A)/sizeof(*A)/2])
#define Max(a,b)    (a>b?a:b)
#define Min(a,b)    (a<b?a:b)
#define Tri_Max(a,b,c)  (a>b?a>c?a:c:b>c?b:c)
#define Tri_Min(a,b,c)  (a<b?a<c?a:c:b<c?b:c)
#define FOR(i, start, end)  for(int i=start ; i<end ; i++)
#define FOR_(i, start,cond) for(int i=start ; cond  ; i++)
#define Debug(msg) printf("%s\n", msg);
#define Debug_I(msg, i) printf("%s %i\n", msg, i);
#define LINE puts("");

#define MAX 100100
int main(){
	int n,A[MAX];
	scanf("%i",&n);
	FOR(i, 0, 2*n) scanf("%i",&A[i]);
	qsort(A, 2*n, sizeof(int), inc_cmp_int);
	ll ans = LLONG_MAX;
	FOR(i, 1, n)
		ans = Min(ans, (ll)(A[2*n-1]-A[0])*(A[i+n-1]-A[i]));
	ans = Min(ans, (ll)(A[n-1]-A[0])*(A[2*n-1]-A[n+1]));
	printf("%I64d\n", ans);
}


//-------------------------------------- Header Files -------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
//---------------------------------------- Data Types -----------------------------------------------------
#define ll long long
#define ld long double

typedef struct {int x,y;}			II;
typedef struct {int x,y,z;}		III;
typedef struct {ll x,y;}			LL;
typedef struct {ll x,y,z;}		LLL;
typedef struct {int v,*nxt;}	IN;
//---------------------------------------- cmp func's -----------------------------------------------------
int inc_cmp_int(const void *a, const void *b){return *(int*)a-*(int*)b;} 										   //increasing
int inc_cmp_ll (const void *a, const void *b){return *(ll*)a==*(ll*)b?0:*(ll*)a>*(ll*)b?1:-1;} //increasing
int inc_cmp_ld (const void *a, const void *b){return *(ld*)a==*(ld*)b?0:*(ld*)a>*(ld*)b?1:-1;} //increasing
int dec_cmp_int(const void *a, const void *b){return *(int*)b-*(int*)a;} 										   //decreasing
int dec_cmp_ll (const void *a, const void *b){return *(ll*)a==*(ll*)b?0:*(ll*)b>*(ll*)a?1:-1;} //decreasing
int dec_cmp_ld (const void *a, const void *b){return *(ld*)a==*(ld*)b?0:*(ld*)b>*(ld*)a?1:-1;} //decreasing
//---------------------------------------- Personal Macros -------------------------------------------------
#define mid_arr(A) (&A[sizeof(A)/sizeof(*A)/2])
#define Max(a,b)    (a>b?a:b)
#define Min(a,b)    (a<b?a:b)
#define Tri_Max(a,b,c)  (a>b?a>c?a:c:b>c?b:c)
#define Tri_Min(a,b,c)  (a<b?a<c?a:c:b<c?b:c)
#define FOR(i, start, end)  for(int i=start ; i<end ; i++)
#define FOR_(i, start,cond) for(int i=start ; cond  ; i++)
#define Debug(msg) printf("%s\n", msg);
#define Debug_I(msg, i) printf("%s %i\n", msg, i);
#define LINE puts("");

#define MAX 100100
int main(){
	int n,A[MAX];
	scanf("%i",&n);
	for(int i=0 ; i<2*n ; i++) scanf("%i",&A[i]);
	qsort(A, 2*n, sizeof(int), inc_cmp_int);
	int ans = INT_MAX;
	for(int i=1 ; i<n ; i++)
		ans = Min(ans, (A[i+n-1]-A[i]));
	ll res = Min( (ll)(A[2*n-1]-A[0])*ans,  (ll)(A[n-1]-A[0])*(A[2*n-1]-A[n]));
	printf("%I64d\n", res);
}


#include <stdio.h>
#include <stdlib.h>
#define ll long long
int inc_cmp_int(const void *a, const void *b){return *(int*)a-*(int*)b;}
#define Min(a,b)    (a<b?a:b)
#define MAX 200200
int n,A[MAX];
int main(){
	scanf("%i",&n);
	for(int i=0 ; i<(2*n) ; i++) scanf("%i",&A[i]);
	qsort(A, 2*n, sizeof(int), inc_cmp_int);
	int ans = 2e9;
	for(int i=1 ; i<n ; i++)
		ans = Min(ans, A[i+n-1]-A[i]);
	ll res = Min( (ll)(A[2*n-1]-A[0])*(ll)ans,  (ll)(A[n-1]-A[0])*(ll)(A[2*n-1]-A[n]));
	printf("%I64d\n", res);
}


#include <stdio.h>
#include <stdlib.h>
#define MAX 100100
#define ll long long
int cmp(void *a,void *b){return *(ll*)a==*(ll*)b?0:*(ll*)a>*(ll*)b?-1:1;}
ll n,A[MAX],i;
int main(){
	for(scanf("%I64d",&n);i<2*n;i++)
		scanf("%I64d",&A[i]);
	qsort(A, 2*n, sizeof(ll), cmp);
	ll x = A[0]-A[n-1];
	ll y = A[n]-A[2*n-1];
	printf("%I64d\n", x*y);
}


#include <stdio.h>
#include <stdlib.h>
#define MAX 100100
int cmp(void *a,void *b){return *(int*)b-*(int*)a;}
int n,A[MAX],i;
int main(){
	for(scanf("%i",&n);i<2*n;i++)
		scanf("%i",&A[i]);
	qsort(A, 2*n, sizeof(int), cmp);
	int x = A[0]-A[n-1];
	int y = A[n]-A[2*n-1];
	printf("%I64d\n", (long long)x*y);
}


//-------------------------------------- Header Files -------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
//---------------------------------------- Data Types -----------------------------------------------------
#define ll long long
#define ld long double

typedef struct {int x,y;}			II;
typedef struct {int x,y,z;}		III;
typedef struct {ll x,y;}			LL;
typedef struct {ll x,y,z;}		LLL;
typedef struct {int v,*nxt;}	IN;
//---------------------------------------- cmp func's -----------------------------------------------------
int inc_cmp_int(const void *a, const void *b){return *(int*)a-*(int*)b;} 										   //increasing
int inc_cmp_ll (const void *a, const void *b){return *(ll*)a==*(ll*)b?0:*(ll*)a>*(ll*)b?1:-1;} //increasing
int inc_cmp_ld (const void *a, const void *b){return *(ld*)a==*(ld*)b?0:*(ld*)a>*(ld*)b?1:-1;} //increasing
int dec_cmp_int(const void *a, const void *b){return *(int*)b-*(int*)a;} 										   //decreasing
int dec_cmp_ll (const void *a, const void *b){return *(ll*)a==*(ll*)b?0:*(ll*)b>*(ll*)a?1:-1;} //decreasing
int dec_cmp_ld (const void *a, const void *b){return *(ld*)a==*(ld*)b?0:*(ld*)b>*(ld*)a?1:-1;} //decreasing
//---------------------------------------- Personal Macros -------------------------------------------------
#define mid_arr(A) (&A[sizeof(A)/sizeof(*A)/2])
#define Max(a,b)    (a>b?a:b)
#define Min(a,b)    (a<b?a:b)
#define Tri_Max(a,b,c)  (a>b?a>c?a:c:b>c?b:c)
#define Tri_Min(a,b,c)  (a<b?a<c?a:c:b<c?b:c)
#define FOR(i, start, end)  for(int i=start ; i<end ; i++)
#define FOR_(i, start,cond) for(int i=start ; cond  ; i++)
#define Debug(msg) printf("%s\n", msg);
#define Debug_I(msg, i) printf("%s %i\n", msg, i);
#define LINE puts("");

#define MAX 100100
int main(){
	int n,A[MAX];
	scanf("%i",&n);
	FOR(i, 0, 2*n) scanf("%i",&A[i]);
	qsort(A, 2*n, sizeof(int), inc_cmp_int);
	int ans = INT_MAX;
	FOR(i, 1, n)
		ans = Min(ans, (A[i+n-1]-A[i]));
	ll res = Min((ll)(A[2*n-1]-A[0])*ans, (ll)(A[n-1]-A[0])*(A[2*n-1]-A[n+1]));
	printf("%I64d\n", res);
}


//-------------------------------------- Header Files -------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
//---------------------------------------- Data Types -----------------------------------------------------
#define ll long long
#define ld long double

typedef struct {int x,y;}			II;
typedef struct {int x,y,z;}		III;
typedef struct {ll x,y;}			LL;
typedef struct {ll x,y,z;}		LLL;
typedef struct {int v,*nxt;}	IN;
//---------------------------------------- cmp func's -----------------------------------------------------
int inc_cmp_int(const void *a, const void *b){return *(int*)a-*(int*)b;} 										   //increasing
int inc_cmp_ll (const void *a, const void *b){return *(ll*)a==*(ll*)b?0:*(ll*)a>*(ll*)b?1:-1;} //increasing
int inc_cmp_ld (const void *a, const void *b){return *(ld*)a==*(ld*)b?0:*(ld*)a>*(ld*)b?1:-1;} //increasing
int dec_cmp_int(const void *a, const void *b){return *(int*)b-*(int*)a;} 										   //decreasing
int dec_cmp_ll (const void *a, const void *b){return *(ll*)a==*(ll*)b?0:*(ll*)b>*(ll*)a?1:-1;} //decreasing
int dec_cmp_ld (const void *a, const void *b){return *(ld*)a==*(ld*)b?0:*(ld*)b>*(ld*)a?1:-1;} //decreasing
//---------------------------------------- Personal Macros -------------------------------------------------
#define mid_arr(A) (&A[sizeof(A)/sizeof(*A)/2])
#define Max(a,b)    (a>b?a:b)
#define Min(a,b)    (a<b?a:b)
#define Tri_Max(a,b,c)  (a>b?a>c?a:c:b>c?b:c)
#define Tri_Min(a,b,c)  (a<b?a<c?a:c:b<c?b:c)
#define FOR(i, start, end)  for(int i=start ; i<end ; i++)
#define FOR_(i, start,cond) for(int i=start ; cond  ; i++)

#define MAX 100100
int main(){
	int n,A[MAX];
	scanf("%i",&n);
	FOR(i, 0, 2*n) scanf("%i",&A[i]);
	qsort(A, 2*n, sizeof(int), inc_cmp_int);
	ll ans =LLONG_MAX;
	//case 1 :
	FOR(i, 1, n)
		ans = Min(ans, (ll)(A[2*n-1]-A[0])*(A[i+n-1]-A[i]));
	//case 2:
	FOR(i, n-1, 2*n-2)
		ans = Min(ans, (ll)(A[i]-A[0])*(A[2*n-1]-A[i+1]));
	printf("%I64d\n", ans);
}


#include <stdio.h>
#include <stdlib.h>
#define ll long long
int inc_cmp_int(const void *a, const void *b){return *(int*)a-*(int*)b;}
#define Min(a,b)    (a<b?a:b)
#define MAX 100100
int n,A[MAX];
int main(){
	scanf("%i",&n);
	for(int i=0 ; i<(2*n) ; i++) scanf("%i",&A[i]);
	qsort(A, 2*n, sizeof(int), inc_cmp_int);
	int ans = 2e9;
	for(int i=1 ; i<n ; i++)
		ans = Min(ans, A[i+n-1]-A[i]);
	ll res = Min( (ll)(A[2*n-1]-A[0])*(ll)ans,  (ll)(A[n-1]-A[0])*(ll)(A[2*n-1]-A[n]));
	printf("%I64d\n", res);
}


#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#define MAX 100100
#define ll long long
#define Min(a,b)    (a<b?a:b)
int cmp(void *a,void *b){return *(ll*)a==*(ll*)b?0:*(ll*)a>*(ll*)b?1:-1;}
ll n,A[MAX],i;
int main(){
	for(scanf("%I64d",&n);i<2*n;i++)
		scanf("%I64d",&A[i]);
	qsort(A, 2*n, sizeof(ll), cmp);
	ll ans =LLONG_MAX;
	for(int i=0 ; i<n-1	 ; i++)
		ans = Min(ans, (A[n-1+i]-A[0])*(A[2*n-1]-A[i+n]));
	for(int i=1 ; i<n-1 ; i++)
		ans = Min(ans, (A[2*n-1]-A[0])*(A[i+n-1]-A[i]));
	printf("%I64d\n",ans);
}


#include <stdio.h>
#include <stdlib.h>
#define MAX 100100
#define ll long long
#define Min(a,b)    (a<b?a:b)
int cmp(void *a,void *b){return *(ll*)a==*(ll*)b?0:*(ll*)a>*(ll*)b?-1:1;}
ll n,A[MAX],i,flag;
int main(){
	for(scanf("%I64d",&n);i<2*n;i++)
		scanf("%I64d",&A[i]);
	qsort(A, 2*n, sizeof(ll), cmp);
	ll x = A[0]-A[n-1];
	ll y = A[n]-A[2*n-1];
	ll ans = Min(x*y, (A[0]-A[n])*(A[n-1]-A[n]));
	printf("%I64d\n", ans);
}


#include <stdio.h>
#include <stdlib.h>

void merge(long arr[], int l, int m, int r)
{
    int i, j, k;
    int n1 = m - l + 1;
    int n2 =  r - m;

    /* create temp arrays */
    long L[n1], R[n2];

    /* Copy data to temp arrays L[] and R[] */
    for (i = 0; i < n1; i++)
        L[i] = arr[l + i];
    for (j = 0; j < n2; j++)
        R[j] = arr[m + 1+ j];

    /* Merge the temp arrays back into arr[l..r]*/
    i = 0; // Initial index of first subarray
    j = 0; // Initial index of second subarray
    k = l; // Initial index of merged subarray
    while (i < n1 && j < n2)
    {
        if (L[i] <= R[j])
        {
            arr[k] = L[i];
            i++;
        }
        else
        {
            arr[k] = R[j];
            j++;
        }
        k++;
    }

    /* Copy the remaining elements of L[], if there
       are any */
    while (i < n1)
    {
        arr[k] = L[i];
        i++;
        k++;
    }

    /* Copy the remaining elements of R[], if there
       are any */
    while (j < n2)
    {
        arr[k] = R[j];
        j++;
        k++;
    }
}

/* l is for left index and r is right index of the
   sub-array of arr to be sorted */
void mergeSort(long arr[], int l, int r)
{
    if (l < r)
    {
        // Same as (l+r)/2, but avoids overflow for
        // large l and h
        int m = l+(r-l)/2;

        // Sort first and second halves
        mergeSort(arr, l, m);
        mergeSort(arr, m+1, r);

        merge(arr, l, m, r);
    }
}

int main()
{
    int n;
    scanf("%d", &n);
    long arr[2*n];
    for(int i=0;i<2*n;i++)
        scanf("%ld", &arr[i]);
    mergeSort(arr, 0, 2*n-1);
    long long min = (arr[n-1]-arr[0]) * (arr[2*n-1] - arr[n]);
    for(int i=1;i<n - 1;i++)
    {
        long long x = (arr[i+n] - arr[0]) * (arr[2*n - 1] - arr[0]);
        if(x < min)
            min = x;
    }
    printf("%lld\n", min);
    return 0;
}