import static java.lang.Math.*;
import java.util.*;
import java.io.*;

public class C {

    public void solve() throws Exception {

        long n = nextInt(), k = nextInt()-1;
        int[] p = nextArr((int)n);

        IncMap m = new IncMap();
        for (int i=0; i<n; ++i) m.add(p[i]);
//      debug(m);

        Arrays.sort(p);
        int a = p[(int)(k/n)];
        int b = p[(int)(k%n)];
//      debug(k/n,b%n);
        if (m.get(a)>1) {
            int c = m.get(a);
            int d = 0;
            for (int i=(int)(k/n)-1; i>=0; --i)
                if (p[i]==a) d++;
                else break;
            b = p[(int)(n*d+k%n)/c];
//          int pos = -1;
//          for (int i=0; i<=n*d+k%n; ++i) {
//              if (i%c==0) pos++;
////                debug(i,pos);
//              b = p[pos];
//          }
        }
//      debug(a,b);
        println(a,b);

    }

    @SuppressWarnings("serial")
    class IncMap extends HashMap<Object, Integer> {
        boolean add(Object key, int amount) {
            Integer i = get(key);
            if (i!=null) {
                put(key, i+amount);
                return false;
            } else {
                put(key, amount);
                return true;
            }
        }
        boolean add(Object key) {
            return add(key, 1);
        }
    }

    ////////////////////////////////////////////////////////////////////////////

    boolean showDebug = true;
    static boolean useFiles = false;
    static String inFile = "input.txt";
    static String outFile = "output.txt";

    double EPS = 1e-7;
    int INF = Integer.MAX_VALUE;
    long INFL = Long.MAX_VALUE;
    double INFD = Double.MAX_VALUE;

    int absPos(int num) {
        return num<0 ? 0:num;
    }
    long absPos(long num) {
        return num<0 ? 0:num;
    }
    double absPos(double num) {
        return num<0 ? 0:num;
    }

    int min(int... nums) {
        int r = Integer.MAX_VALUE;
        for (int i: nums)
            if (i<r) r=i;
        return r;
    }
    int max(int... nums) {
        int r = Integer.MIN_VALUE;
        for (int i: nums)
            if (i>r) r=i;
        return r;
    }
    long minL(long... nums) {
        long r = Long.MAX_VALUE;
        for (long i: nums)
            if (i<r) r=i;
        return r;
    }
    long maxL(long... nums) {
        long r = Long.MIN_VALUE;
        for (long i: nums)
            if (i>r) r=i;
        return r;
    }
    double minD(double... nums) {
        double r = Double.MAX_VALUE;
        for (double i: nums)
            if (i<r) r=i;
        return r;
    }
    double maxD(double... nums) {
        double r = Double.MIN_VALUE;
        for (double i: nums)
            if (i>r) r=i;
        return r;
    }

    long sumArr(int[] arr) {
        long res = 0;
        for (int i: arr)
            res+=i;
        return res;
    }
    long sumArr(long[] arr) {
        long res = 0;
        for (long i: arr)
            res+=i;
        return res;
    }
    double sumArr(double[] arr) {
        double res = 0;
        for (double i: arr)
            res+=i;
        return res;
    }

    long partsFitCnt(long partSize, long wholeSize) {
        return (partSize+wholeSize-1)/partSize;
    }

    boolean odd(long num) {
        return (num&1)==1;
    }

    boolean hasBit(int num, int pos) {
        return (num&(1<<pos))>0;
    }

    long binpow(long a, int n) {
        long r = 1;
        while (n>0) {
            if ((n&1)!=0) r*=a;
            a*=a;
            n>>=1;
        }
        return r;
    }

    boolean isLetter(char c) {
        return (c>='a' && c<='z') || (c>='A' && c<='Z');
    }
    boolean isLowercase(char c) {
        return (c>='a' && c<='z');
    }
    boolean isUppercase(char c) {
        return (c>='A' && c<='Z');
    }
    boolean isDigit(char c) {
        return (c>='0' && c<='9');
    }

    boolean charIn(String chars, String s) {
        if (s==null) return false;
        if (chars==null || chars.equals("")) return true;
        for (int i=0; i<s.length(); ++i)
            for (int j=0; j<chars.length(); ++j)
                if (chars.charAt(j)==s.charAt(i)) return true;
        return false;
    }

    String stringn(String s, int n) {
        if (n<1 || s==null) return "";
        StringBuilder sb = new StringBuilder(s.length()*n);
        for (int i=0; i<n; ++i) sb.append(s);
        return sb.toString();
    }
    String str(Object o) {
        if (o==null) return "";
        return o.toString();
    }

    long timer = System.currentTimeMillis();
    void startTimer() {
        timer = System.currentTimeMillis();
    }
    void stopTimer() {
        System.err.println("time: "+(System.currentTimeMillis()-timer)/1000.0);
    }

    static class InputReader {
        private byte[] buf;
        private int bufPos = 0, bufLim = -1;
        private InputStream stream;
        public InputReader(InputStream stream, int size) {
            buf = new byte[size];
            this.stream = stream;
        }
        private void fillBuf() throws IOException {
            bufLim = stream.read(buf);
            bufPos = 0;
        }
        char read() throws IOException {
            if (bufPos>=bufLim) fillBuf();
            return (char)buf[bufPos++];
        }
        boolean hasInput() throws IOException {
            if (bufPos>=bufLim) fillBuf();
            return bufPos<bufLim;
        }
    }

    static InputReader inputReader;
    static BufferedWriter outputWriter;

    char nextChar() throws IOException {
        return inputReader.read();
    }
    char nextNonWhitespaceChar() throws IOException {
        char c = inputReader.read();
        while (c<=' ') c=inputReader.read();
        return c;
    }
    String nextWord() throws IOException {
        StringBuilder sb = new StringBuilder();
        char c = inputReader.read();
        while (c<=' ') c=inputReader.read();
        while (c>' ') {
            sb.append(c);
            c = inputReader.read();
        }
        return new String(sb);
    }
    String nextLine() throws IOException {
        StringBuilder sb = new StringBuilder();
        char c = inputReader.read();
        while (c<=' ') c=inputReader.read();
        while (c!='\n' && c!='\r') {
            sb.append(c);
            c = inputReader.read();
        }
        return new String(sb);
    }
    int nextInt() throws IOException {
        int r = 0;
        char c = nextNonWhitespaceChar();
        boolean neg = false;
        if (c=='-') neg=true;
        else r=c-48;
        c = nextChar();
        while (c>='0' && c<='9') {
            r*=10;
            r+=c-48;
            c=nextChar();
        }
        return neg ? -r:r;
    }
    long nextLong() throws IOException {
        long r = 0;
        char c = nextNonWhitespaceChar();
        boolean neg = false;
        if (c=='-') neg=true;
        else r = c-48;
        c = nextChar();
        while (c>='0' && c<='9') {
            r*=10L;
            r+=c-48L;
            c=nextChar();
        }
        return neg ? -r:r;
    }
    double nextDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(nextWord());
    }
    int[] nextArr(int size) throws NumberFormatException, IOException {
        int[] arr = new int[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextInt();
        return arr;
    }
    long[] nextArrL(int size) throws NumberFormatException, IOException {
        long[] arr = new long[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextLong();
        return arr;
    }
    double[] nextArrD(int size) throws NumberFormatException, IOException {
        double[] arr = new double[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextDouble();
        return arr;
    }
    String[] nextArrS(int size) throws NumberFormatException, IOException {
        String[] arr = new String[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextWord();
        return arr;
    }
    char[] nextArrCh(int size) throws IOException {
        char[] arr = new char[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextNonWhitespaceChar();
        return arr;
    }
    char[][] nextArrCh(int rows, int columns) throws IOException {
        char[][] arr = new char[rows][columns];
        for (int i=0; i<rows; ++i)
            for (int j=0; j<columns; ++j)
                arr[i][j] = nextNonWhitespaceChar();
        return arr;
    }
    char[][] nextArrChBorders(int rows, int columns, char border) throws IOException {
        char[][] arr = new char[rows+2][columns+2];
        for (int i=1; i<=rows; ++i)
            for (int j=1; j<=columns; ++j)
                arr[i][j] = nextNonWhitespaceChar();
        for (int i=0; i<columns+2; ++i) {
            arr[0][i] = border;
            arr[rows+1][i] = border;
        }
        for (int i=0; i<rows+2; ++i) {
            arr[i][0] = border;
            arr[i][columns+1] = border;
        }
        return arr;
    }

    void printf(String format, Object... args) throws IOException {
        outputWriter.write(String.format(format, args));
    }
    void print(Object o) throws IOException {
        outputWriter.write(o.toString());
    }
    void println(Object o) throws IOException {
        outputWriter.write(o.toString());
        outputWriter.newLine();
    }
    void print(Object... o) throws IOException {
        for (int i=0; i<o.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(o[i].toString());
        }
    }
    void println(Object... o) throws IOException {
        print(o);
        outputWriter.newLine();
    }
    void printn(Object o, int n) throws IOException {
        String s = o.toString();
        for (int i=0; i<n; ++i) {
            outputWriter.write(s);
            if (i!=n-1) outputWriter.write(' ');
        }
    }
    void printnln(Object o, int n) throws IOException {
        printn(o, n);
        outputWriter.newLine();
    }
    void printArr(int[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(Integer.toString(arr[i]));
        }
    }
    void printArr(long[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(Long.toString(arr[i]));
        }
    }
    void printArr(double[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(Double.toString(arr[i]));
        }
    }
    void printArr(String[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(arr[i]);
        }
    }
    void printArr(char[] arr) throws IOException {
        for (char c: arr) outputWriter.write(c);
    }
    void printlnArr(int[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(long[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(double[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(String[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(char[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void halt(Object... o) throws IOException {
        if (o.length!=0) println(o);
        outputWriter.flush(); outputWriter.close();
        System.exit(0);
    }

    void debug(Object... o) {
        if (showDebug) System.err.println(Arrays.deepToString(o));
    }

    public static void main(String[] args) throws Exception {
        Locale.setDefault(Locale.US);
        if (!useFiles) {
            inputReader = new InputReader(System.in, 1<<16);
            outputWriter = new BufferedWriter(new OutputStreamWriter(System.out), 1<<16);
        } else {
            inputReader = new InputReader(new FileInputStream(new File(inFile)), 1<<16);
            outputWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outFile))), 1<<16);
        }
        new C().solve();
        outputWriter.flush(); outputWriter.close();
    }
}


import static java.lang.Math.*;
import java.util.*;
import java.io.*;

public class C {

    public void solve() throws Exception {

        long n = nextLong(), k = nextLong()-1;
        int[] p = nextArr((int)n);
//      for (long k=0; k<n*n; ++k) {

        IncMap m = new IncMap();
        for (int i=0; i<n; ++i) m.add(p[i]);
//      debug(m);

        Arrays.sort(p);
        int a = p[(int)(k/n)];
        int b = p[(int)(k%n)];
//      debug(k/n,b%n);
        if (m.get(a)>1) {
            int c = m.get(a);
            int d = 0;
            for (int i=(int)(k/n)-1; i>=0; --i)
                if (p[i]==a) d++;
                else break;
            b = p[(int)((n*d+k%n)/c)];
//          debug()
//          int pos = -1;
//          for (int i=0; i<=n*d+k%n; ++i) {
//              if (i%c==0) pos++;
////                debug(i,pos);
//              b = p[pos];
//          }
        }
//      debug(a,b);
        println(a,b);

    }

    @SuppressWarnings("serial")
    class IncMap extends TreeMap<Object, Integer> {
        boolean add(Object key, int amount) {
            Integer i = get(key);
            if (i!=null) {
                put(key, i+amount);
                return false;
            } else {
                put(key, amount);
                return true;
            }
        }
        boolean add(Object key) {
            return add(key, 1);
        }
    }

    ////////////////////////////////////////////////////////////////////////////

    boolean showDebug = true;
    static boolean useFiles = false;
    static String inFile = "input.txt";
    static String outFile = "output.txt";

    double EPS = 1e-7;
    int INF = Integer.MAX_VALUE;
    long INFL = Long.MAX_VALUE;
    double INFD = Double.MAX_VALUE;

    int absPos(int num) {
        return num<0 ? 0:num;
    }
    long absPos(long num) {
        return num<0 ? 0:num;
    }
    double absPos(double num) {
        return num<0 ? 0:num;
    }

    int min(int... nums) {
        int r = Integer.MAX_VALUE;
        for (int i: nums)
            if (i<r) r=i;
        return r;
    }
    int max(int... nums) {
        int r = Integer.MIN_VALUE;
        for (int i: nums)
            if (i>r) r=i;
        return r;
    }
    long minL(long... nums) {
        long r = Long.MAX_VALUE;
        for (long i: nums)
            if (i<r) r=i;
        return r;
    }
    long maxL(long... nums) {
        long r = Long.MIN_VALUE;
        for (long i: nums)
            if (i>r) r=i;
        return r;
    }
    double minD(double... nums) {
        double r = Double.MAX_VALUE;
        for (double i: nums)
            if (i<r) r=i;
        return r;
    }
    double maxD(double... nums) {
        double r = Double.MIN_VALUE;
        for (double i: nums)
            if (i>r) r=i;
        return r;
    }

    long sumArr(int[] arr) {
        long res = 0;
        for (int i: arr)
            res+=i;
        return res;
    }
    long sumArr(long[] arr) {
        long res = 0;
        for (long i: arr)
            res+=i;
        return res;
    }
    double sumArr(double[] arr) {
        double res = 0;
        for (double i: arr)
            res+=i;
        return res;
    }

    long partsFitCnt(long partSize, long wholeSize) {
        return (partSize+wholeSize-1)/partSize;
    }

    boolean odd(long num) {
        return (num&1)==1;
    }

    boolean hasBit(int num, int pos) {
        return (num&(1<<pos))>0;
    }

    long binpow(long a, int n) {
        long r = 1;
        while (n>0) {
            if ((n&1)!=0) r*=a;
            a*=a;
            n>>=1;
        }
        return r;
    }

    boolean isLetter(char c) {
        return (c>='a' && c<='z') || (c>='A' && c<='Z');
    }
    boolean isLowercase(char c) {
        return (c>='a' && c<='z');
    }
    boolean isUppercase(char c) {
        return (c>='A' && c<='Z');
    }
    boolean isDigit(char c) {
        return (c>='0' && c<='9');
    }

    boolean charIn(String chars, String s) {
        if (s==null) return false;
        if (chars==null || chars.equals("")) return true;
        for (int i=0; i<s.length(); ++i)
            for (int j=0; j<chars.length(); ++j)
                if (chars.charAt(j)==s.charAt(i)) return true;
        return false;
    }

    String stringn(String s, int n) {
        if (n<1 || s==null) return "";
        StringBuilder sb = new StringBuilder(s.length()*n);
        for (int i=0; i<n; ++i) sb.append(s);
        return sb.toString();
    }
    String str(Object o) {
        if (o==null) return "";
        return o.toString();
    }

    long timer = System.currentTimeMillis();
    void startTimer() {
        timer = System.currentTimeMillis();
    }
    void stopTimer() {
        System.err.println("time: "+(System.currentTimeMillis()-timer)/1000.0);
    }

    static class InputReader {
        private byte[] buf;
        private int bufPos = 0, bufLim = -1;
        private InputStream stream;
        public InputReader(InputStream stream, int size) {
            buf = new byte[size];
            this.stream = stream;
        }
        private void fillBuf() throws IOException {
            bufLim = stream.read(buf);
            bufPos = 0;
        }
        char read() throws IOException {
            if (bufPos>=bufLim) fillBuf();
            return (char)buf[bufPos++];
        }
        boolean hasInput() throws IOException {
            if (bufPos>=bufLim) fillBuf();
            return bufPos<bufLim;
        }
    }

    static InputReader inputReader;
    static BufferedWriter outputWriter;

    char nextChar() throws IOException {
        return inputReader.read();
    }
    char nextNonWhitespaceChar() throws IOException {
        char c = inputReader.read();
        while (c<=' ') c=inputReader.read();
        return c;
    }
    String nextWord() throws IOException {
        StringBuilder sb = new StringBuilder();
        char c = inputReader.read();
        while (c<=' ') c=inputReader.read();
        while (c>' ') {
            sb.append(c);
            c = inputReader.read();
        }
        return new String(sb);
    }
    String nextLine() throws IOException {
        StringBuilder sb = new StringBuilder();
        char c = inputReader.read();
        while (c<=' ') c=inputReader.read();
        while (c!='\n' && c!='\r') {
            sb.append(c);
            c = inputReader.read();
        }
        return new String(sb);
    }
    int nextInt() throws IOException {
        int r = 0;
        char c = nextNonWhitespaceChar();
        boolean neg = false;
        if (c=='-') neg=true;
        else r=c-48;
        c = nextChar();
        while (c>='0' && c<='9') {
            r*=10;
            r+=c-48;
            c=nextChar();
        }
        return neg ? -r:r;
    }
    long nextLong() throws IOException {
        long r = 0;
        char c = nextNonWhitespaceChar();
        boolean neg = false;
        if (c=='-') neg=true;
        else r = c-48;
        c = nextChar();
        while (c>='0' && c<='9') {
            r*=10L;
            r+=c-48L;
            c=nextChar();
        }
        return neg ? -r:r;
    }
    double nextDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(nextWord());
    }
    int[] nextArr(int size) throws NumberFormatException, IOException {
        int[] arr = new int[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextInt();
        return arr;
    }
    long[] nextArrL(int size) throws NumberFormatException, IOException {
        long[] arr = new long[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextLong();
        return arr;
    }
    double[] nextArrD(int size) throws NumberFormatException, IOException {
        double[] arr = new double[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextDouble();
        return arr;
    }
    String[] nextArrS(int size) throws NumberFormatException, IOException {
        String[] arr = new String[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextWord();
        return arr;
    }
    char[] nextArrCh(int size) throws IOException {
        char[] arr = new char[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextNonWhitespaceChar();
        return arr;
    }
    char[][] nextArrCh(int rows, int columns) throws IOException {
        char[][] arr = new char[rows][columns];
        for (int i=0; i<rows; ++i)
            for (int j=0; j<columns; ++j)
                arr[i][j] = nextNonWhitespaceChar();
        return arr;
    }
    char[][] nextArrChBorders(int rows, int columns, char border) throws IOException {
        char[][] arr = new char[rows+2][columns+2];
        for (int i=1; i<=rows; ++i)
            for (int j=1; j<=columns; ++j)
                arr[i][j] = nextNonWhitespaceChar();
        for (int i=0; i<columns+2; ++i) {
            arr[0][i] = border;
            arr[rows+1][i] = border;
        }
        for (int i=0; i<rows+2; ++i) {
            arr[i][0] = border;
            arr[i][columns+1] = border;
        }
        return arr;
    }

    void printf(String format, Object... args) throws IOException {
        outputWriter.write(String.format(format, args));
    }
    void print(Object o) throws IOException {
        outputWriter.write(o.toString());
    }
    void println(Object o) throws IOException {
        outputWriter.write(o.toString());
        outputWriter.newLine();
    }
    void print(Object... o) throws IOException {
        for (int i=0; i<o.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(o[i].toString());
        }
    }
    void println(Object... o) throws IOException {
        print(o);
        outputWriter.newLine();
    }
    void printn(Object o, int n) throws IOException {
        String s = o.toString();
        for (int i=0; i<n; ++i) {
            outputWriter.write(s);
            if (i!=n-1) outputWriter.write(' ');
        }
    }
    void printnln(Object o, int n) throws IOException {
        printn(o, n);
        outputWriter.newLine();
    }
    void printArr(int[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(Integer.toString(arr[i]));
        }
    }
    void printArr(long[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(Long.toString(arr[i]));
        }
    }
    void printArr(double[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(Double.toString(arr[i]));
        }
    }
    void printArr(String[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(arr[i]);
        }
    }
    void printArr(char[] arr) throws IOException {
        for (char c: arr) outputWriter.write(c);
    }
    void printlnArr(int[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(long[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(double[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(String[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(char[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void halt(Object... o) throws IOException {
        if (o.length!=0) println(o);
        outputWriter.flush(); outputWriter.close();
        System.exit(0);
    }

    void debug(Object... o) {
        if (showDebug) System.err.println(Arrays.deepToString(o));
    }

    public static void main(String[] args) throws Exception {
        Locale.setDefault(Locale.US);
        if (!useFiles) {
            inputReader = new InputReader(System.in, 1<<16);
            outputWriter = new BufferedWriter(new OutputStreamWriter(System.out), 1<<16);
        } else {
            inputReader = new InputReader(new FileInputStream(new File(inFile)), 1<<16);
            outputWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outFile))), 1<<16);
        }
        new C().solve();
        outputWriter.flush(); outputWriter.close();
    }
}


import static java.lang.Math.*;
import java.util.*;
import java.io.*;

public class C {

    public void solve() throws Exception {

        long n = nextInt(), k = nextInt()-1;
        int[] p = nextArr((int)n);
//      for (long k=0; k<n*n; ++k) {

        IncMap m = new IncMap();
        for (int i=0; i<n; ++i) m.add(p[i]);
//      debug(m);

        Arrays.sort(p);
        int a = p[(int)(k/n)];
        int b = p[(int)(k%n)];
//      debug(k/n,b%n);
        if (m.get(a)>1) {
            int c = m.get(a);
            int d = 0;
            for (int i=(int)(k/n)-1; i>=0; --i)
                if (p[i]==a) d++;
                else break;
            b = p[(int)((n*d+k%n)/c)];
//          debug()
//          int pos = -1;
//          for (int i=0; i<=n*d+k%n; ++i) {
//              if (i%c==0) pos++;
////                debug(i,pos);
//              b = p[pos];
//          }
        }
//      debug(a,b);
        println(a,b);

    }

    @SuppressWarnings("serial")
    class IncMap extends HashMap<Object, Integer> {
        boolean add(Object key, int amount) {
            Integer i = get(key);
            if (i!=null) {
                put(key, i+amount);
                return false;
            } else {
                put(key, amount);
                return true;
            }
        }
        boolean add(Object key) {
            return add(key, 1);
        }
    }

    ////////////////////////////////////////////////////////////////////////////

    boolean showDebug = true;
    static boolean useFiles = false;
    static String inFile = "input.txt";
    static String outFile = "output.txt";

    double EPS = 1e-7;
    int INF = Integer.MAX_VALUE;
    long INFL = Long.MAX_VALUE;
    double INFD = Double.MAX_VALUE;

    int absPos(int num) {
        return num<0 ? 0:num;
    }
    long absPos(long num) {
        return num<0 ? 0:num;
    }
    double absPos(double num) {
        return num<0 ? 0:num;
    }

    int min(int... nums) {
        int r = Integer.MAX_VALUE;
        for (int i: nums)
            if (i<r) r=i;
        return r;
    }
    int max(int... nums) {
        int r = Integer.MIN_VALUE;
        for (int i: nums)
            if (i>r) r=i;
        return r;
    }
    long minL(long... nums) {
        long r = Long.MAX_VALUE;
        for (long i: nums)
            if (i<r) r=i;
        return r;
    }
    long maxL(long... nums) {
        long r = Long.MIN_VALUE;
        for (long i: nums)
            if (i>r) r=i;
        return r;
    }
    double minD(double... nums) {
        double r = Double.MAX_VALUE;
        for (double i: nums)
            if (i<r) r=i;
        return r;
    }
    double maxD(double... nums) {
        double r = Double.MIN_VALUE;
        for (double i: nums)
            if (i>r) r=i;
        return r;
    }

    long sumArr(int[] arr) {
        long res = 0;
        for (int i: arr)
            res+=i;
        return res;
    }
    long sumArr(long[] arr) {
        long res = 0;
        for (long i: arr)
            res+=i;
        return res;
    }
    double sumArr(double[] arr) {
        double res = 0;
        for (double i: arr)
            res+=i;
        return res;
    }

    long partsFitCnt(long partSize, long wholeSize) {
        return (partSize+wholeSize-1)/partSize;
    }

    boolean odd(long num) {
        return (num&1)==1;
    }

    boolean hasBit(int num, int pos) {
        return (num&(1<<pos))>0;
    }

    long binpow(long a, int n) {
        long r = 1;
        while (n>0) {
            if ((n&1)!=0) r*=a;
            a*=a;
            n>>=1;
        }
        return r;
    }

    boolean isLetter(char c) {
        return (c>='a' && c<='z') || (c>='A' && c<='Z');
    }
    boolean isLowercase(char c) {
        return (c>='a' && c<='z');
    }
    boolean isUppercase(char c) {
        return (c>='A' && c<='Z');
    }
    boolean isDigit(char c) {
        return (c>='0' && c<='9');
    }

    boolean charIn(String chars, String s) {
        if (s==null) return false;
        if (chars==null || chars.equals("")) return true;
        for (int i=0; i<s.length(); ++i)
            for (int j=0; j<chars.length(); ++j)
                if (chars.charAt(j)==s.charAt(i)) return true;
        return false;
    }

    String stringn(String s, int n) {
        if (n<1 || s==null) return "";
        StringBuilder sb = new StringBuilder(s.length()*n);
        for (int i=0; i<n; ++i) sb.append(s);
        return sb.toString();
    }
    String str(Object o) {
        if (o==null) return "";
        return o.toString();
    }

    long timer = System.currentTimeMillis();
    void startTimer() {
        timer = System.currentTimeMillis();
    }
    void stopTimer() {
        System.err.println("time: "+(System.currentTimeMillis()-timer)/1000.0);
    }

    static class InputReader {
        private byte[] buf;
        private int bufPos = 0, bufLim = -1;
        private InputStream stream;
        public InputReader(InputStream stream, int size) {
            buf = new byte[size];
            this.stream = stream;
        }
        private void fillBuf() throws IOException {
            bufLim = stream.read(buf);
            bufPos = 0;
        }
        char read() throws IOException {
            if (bufPos>=bufLim) fillBuf();
            return (char)buf[bufPos++];
        }
        boolean hasInput() throws IOException {
            if (bufPos>=bufLim) fillBuf();
            return bufPos<bufLim;
        }
    }

    static InputReader inputReader;
    static BufferedWriter outputWriter;

    char nextChar() throws IOException {
        return inputReader.read();
    }
    char nextNonWhitespaceChar() throws IOException {
        char c = inputReader.read();
        while (c<=' ') c=inputReader.read();
        return c;
    }
    String nextWord() throws IOException {
        StringBuilder sb = new StringBuilder();
        char c = inputReader.read();
        while (c<=' ') c=inputReader.read();
        while (c>' ') {
            sb.append(c);
            c = inputReader.read();
        }
        return new String(sb);
    }
    String nextLine() throws IOException {
        StringBuilder sb = new StringBuilder();
        char c = inputReader.read();
        while (c<=' ') c=inputReader.read();
        while (c!='\n' && c!='\r') {
            sb.append(c);
            c = inputReader.read();
        }
        return new String(sb);
    }
    int nextInt() throws IOException {
        int r = 0;
        char c = nextNonWhitespaceChar();
        boolean neg = false;
        if (c=='-') neg=true;
        else r=c-48;
        c = nextChar();
        while (c>='0' && c<='9') {
            r*=10;
            r+=c-48;
            c=nextChar();
        }
        return neg ? -r:r;
    }
    long nextLong() throws IOException {
        long r = 0;
        char c = nextNonWhitespaceChar();
        boolean neg = false;
        if (c=='-') neg=true;
        else r = c-48;
        c = nextChar();
        while (c>='0' && c<='9') {
            r*=10L;
            r+=c-48L;
            c=nextChar();
        }
        return neg ? -r:r;
    }
    double nextDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(nextWord());
    }
    int[] nextArr(int size) throws NumberFormatException, IOException {
        int[] arr = new int[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextInt();
        return arr;
    }
    long[] nextArrL(int size) throws NumberFormatException, IOException {
        long[] arr = new long[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextLong();
        return arr;
    }
    double[] nextArrD(int size) throws NumberFormatException, IOException {
        double[] arr = new double[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextDouble();
        return arr;
    }
    String[] nextArrS(int size) throws NumberFormatException, IOException {
        String[] arr = new String[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextWord();
        return arr;
    }
    char[] nextArrCh(int size) throws IOException {
        char[] arr = new char[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextNonWhitespaceChar();
        return arr;
    }
    char[][] nextArrCh(int rows, int columns) throws IOException {
        char[][] arr = new char[rows][columns];
        for (int i=0; i<rows; ++i)
            for (int j=0; j<columns; ++j)
                arr[i][j] = nextNonWhitespaceChar();
        return arr;
    }
    char[][] nextArrChBorders(int rows, int columns, char border) throws IOException {
        char[][] arr = new char[rows+2][columns+2];
        for (int i=1; i<=rows; ++i)
            for (int j=1; j<=columns; ++j)
                arr[i][j] = nextNonWhitespaceChar();
        for (int i=0; i<columns+2; ++i) {
            arr[0][i] = border;
            arr[rows+1][i] = border;
        }
        for (int i=0; i<rows+2; ++i) {
            arr[i][0] = border;
            arr[i][columns+1] = border;
        }
        return arr;
    }

    void printf(String format, Object... args) throws IOException {
        outputWriter.write(String.format(format, args));
    }
    void print(Object o) throws IOException {
        outputWriter.write(o.toString());
    }
    void println(Object o) throws IOException {
        outputWriter.write(o.toString());
        outputWriter.newLine();
    }
    void print(Object... o) throws IOException {
        for (int i=0; i<o.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(o[i].toString());
        }
    }
    void println(Object... o) throws IOException {
        print(o);
        outputWriter.newLine();
    }
    void printn(Object o, int n) throws IOException {
        String s = o.toString();
        for (int i=0; i<n; ++i) {
            outputWriter.write(s);
            if (i!=n-1) outputWriter.write(' ');
        }
    }
    void printnln(Object o, int n) throws IOException {
        printn(o, n);
        outputWriter.newLine();
    }
    void printArr(int[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(Integer.toString(arr[i]));
        }
    }
    void printArr(long[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(Long.toString(arr[i]));
        }
    }
    void printArr(double[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(Double.toString(arr[i]));
        }
    }
    void printArr(String[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(arr[i]);
        }
    }
    void printArr(char[] arr) throws IOException {
        for (char c: arr) outputWriter.write(c);
    }
    void printlnArr(int[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(long[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(double[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(String[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(char[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void halt(Object... o) throws IOException {
        if (o.length!=0) println(o);
        outputWriter.flush(); outputWriter.close();
        System.exit(0);
    }

    void debug(Object... o) {
        if (showDebug) System.err.println(Arrays.deepToString(o));
    }

    public static void main(String[] args) throws Exception {
        Locale.setDefault(Locale.US);
        if (!useFiles) {
            inputReader = new InputReader(System.in, 1<<16);
            outputWriter = new BufferedWriter(new OutputStreamWriter(System.out), 1<<16);
        } else {
            inputReader = new InputReader(new FileInputStream(new File(inFile)), 1<<16);
            outputWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outFile))), 1<<16);
        }
        new C().solve();
        outputWriter.flush(); outputWriter.close();
    }
}


import static java.lang.Math.*;
import java.util.*;
import java.io.*;

public class C {

    public void solve() throws Exception {

        long n = nextLong(), k = nextLong()-1;
        int[] p = nextArr((int)n);
//      for (long k=0; k<n*n; ++k) {

        IncMap m = new IncMap();
        for (int i=0; i<n; ++i) m.add(p[i]);
//      debug(m);

        Arrays.sort(p);
        int a = p[(int)(k/n)];
        int b = p[(int)(k%n)];
//      debug(k/n,b%n);
        if (m.get(a)>1) {
            int c = m.get(a);
            int d = 0;
            for (int i=(int)(k/n)-1; i>=0; --i)
                if (p[i]==a) d++;
                else break;
            b = p[(int)((n*d+k%n)/c)];
//          debug()
//          int pos = -1;
//          for (int i=0; i<=n*d+k%n; ++i) {
//              if (i%c==0) pos++;
////                debug(i,pos);
//              b = p[pos];
//          }
        }
//      debug(a,b);
        println(a,b);

    }

    @SuppressWarnings("serial")
    class IncMap extends HashMap<Object, Integer> {
        boolean add(Object key, int amount) {
            Integer i = get(key);
            if (i!=null) {
                put(key, i+amount);
                return false;
            } else {
                put(key, amount);
                return true;
            }
        }
        boolean add(Object key) {
            return add(key, 1);
        }
    }

    ////////////////////////////////////////////////////////////////////////////

    boolean showDebug = true;
    static boolean useFiles = false;
    static String inFile = "input.txt";
    static String outFile = "output.txt";

    double EPS = 1e-7;
    int INF = Integer.MAX_VALUE;
    long INFL = Long.MAX_VALUE;
    double INFD = Double.MAX_VALUE;

    int absPos(int num) {
        return num<0 ? 0:num;
    }
    long absPos(long num) {
        return num<0 ? 0:num;
    }
    double absPos(double num) {
        return num<0 ? 0:num;
    }

    int min(int... nums) {
        int r = Integer.MAX_VALUE;
        for (int i: nums)
            if (i<r) r=i;
        return r;
    }
    int max(int... nums) {
        int r = Integer.MIN_VALUE;
        for (int i: nums)
            if (i>r) r=i;
        return r;
    }
    long minL(long... nums) {
        long r = Long.MAX_VALUE;
        for (long i: nums)
            if (i<r) r=i;
        return r;
    }
    long maxL(long... nums) {
        long r = Long.MIN_VALUE;
        for (long i: nums)
            if (i>r) r=i;
        return r;
    }
    double minD(double... nums) {
        double r = Double.MAX_VALUE;
        for (double i: nums)
            if (i<r) r=i;
        return r;
    }
    double maxD(double... nums) {
        double r = Double.MIN_VALUE;
        for (double i: nums)
            if (i>r) r=i;
        return r;
    }

    long sumArr(int[] arr) {
        long res = 0;
        for (int i: arr)
            res+=i;
        return res;
    }
    long sumArr(long[] arr) {
        long res = 0;
        for (long i: arr)
            res+=i;
        return res;
    }
    double sumArr(double[] arr) {
        double res = 0;
        for (double i: arr)
            res+=i;
        return res;
    }

    long partsFitCnt(long partSize, long wholeSize) {
        return (partSize+wholeSize-1)/partSize;
    }

    boolean odd(long num) {
        return (num&1)==1;
    }

    boolean hasBit(int num, int pos) {
        return (num&(1<<pos))>0;
    }

    long binpow(long a, int n) {
        long r = 1;
        while (n>0) {
            if ((n&1)!=0) r*=a;
            a*=a;
            n>>=1;
        }
        return r;
    }

    boolean isLetter(char c) {
        return (c>='a' && c<='z') || (c>='A' && c<='Z');
    }
    boolean isLowercase(char c) {
        return (c>='a' && c<='z');
    }
    boolean isUppercase(char c) {
        return (c>='A' && c<='Z');
    }
    boolean isDigit(char c) {
        return (c>='0' && c<='9');
    }

    boolean charIn(String chars, String s) {
        if (s==null) return false;
        if (chars==null || chars.equals("")) return true;
        for (int i=0; i<s.length(); ++i)
            for (int j=0; j<chars.length(); ++j)
                if (chars.charAt(j)==s.charAt(i)) return true;
        return false;
    }

    String stringn(String s, int n) {
        if (n<1 || s==null) return "";
        StringBuilder sb = new StringBuilder(s.length()*n);
        for (int i=0; i<n; ++i) sb.append(s);
        return sb.toString();
    }
    String str(Object o) {
        if (o==null) return "";
        return o.toString();
    }

    long timer = System.currentTimeMillis();
    void startTimer() {
        timer = System.currentTimeMillis();
    }
    void stopTimer() {
        System.err.println("time: "+(System.currentTimeMillis()-timer)/1000.0);
    }

    static class InputReader {
        private byte[] buf;
        private int bufPos = 0, bufLim = -1;
        private InputStream stream;
        public InputReader(InputStream stream, int size) {
            buf = new byte[size];
            this.stream = stream;
        }
        private void fillBuf() throws IOException {
            bufLim = stream.read(buf);
            bufPos = 0;
        }
        char read() throws IOException {
            if (bufPos>=bufLim) fillBuf();
            return (char)buf[bufPos++];
        }
        boolean hasInput() throws IOException {
            if (bufPos>=bufLim) fillBuf();
            return bufPos<bufLim;
        }
    }

    static InputReader inputReader;
    static BufferedWriter outputWriter;

    char nextChar() throws IOException {
        return inputReader.read();
    }
    char nextNonWhitespaceChar() throws IOException {
        char c = inputReader.read();
        while (c<=' ') c=inputReader.read();
        return c;
    }
    String nextWord() throws IOException {
        StringBuilder sb = new StringBuilder();
        char c = inputReader.read();
        while (c<=' ') c=inputReader.read();
        while (c>' ') {
            sb.append(c);
            c = inputReader.read();
        }
        return new String(sb);
    }
    String nextLine() throws IOException {
        StringBuilder sb = new StringBuilder();
        char c = inputReader.read();
        while (c<=' ') c=inputReader.read();
        while (c!='\n' && c!='\r') {
            sb.append(c);
            c = inputReader.read();
        }
        return new String(sb);
    }
    int nextInt() throws IOException {
        int r = 0;
        char c = nextNonWhitespaceChar();
        boolean neg = false;
        if (c=='-') neg=true;
        else r=c-48;
        c = nextChar();
        while (c>='0' && c<='9') {
            r*=10;
            r+=c-48;
            c=nextChar();
        }
        return neg ? -r:r;
    }
    long nextLong() throws IOException {
        long r = 0;
        char c = nextNonWhitespaceChar();
        boolean neg = false;
        if (c=='-') neg=true;
        else r = c-48;
        c = nextChar();
        while (c>='0' && c<='9') {
            r*=10L;
            r+=c-48L;
            c=nextChar();
        }
        return neg ? -r:r;
    }
    double nextDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(nextWord());
    }
    int[] nextArr(int size) throws NumberFormatException, IOException {
        int[] arr = new int[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextInt();
        return arr;
    }
    long[] nextArrL(int size) throws NumberFormatException, IOException {
        long[] arr = new long[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextLong();
        return arr;
    }
    double[] nextArrD(int size) throws NumberFormatException, IOException {
        double[] arr = new double[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextDouble();
        return arr;
    }
    String[] nextArrS(int size) throws NumberFormatException, IOException {
        String[] arr = new String[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextWord();
        return arr;
    }
    char[] nextArrCh(int size) throws IOException {
        char[] arr = new char[size];
        for (int i=0; i<size; ++i)
            arr[i] = nextNonWhitespaceChar();
        return arr;
    }
    char[][] nextArrCh(int rows, int columns) throws IOException {
        char[][] arr = new char[rows][columns];
        for (int i=0; i<rows; ++i)
            for (int j=0; j<columns; ++j)
                arr[i][j] = nextNonWhitespaceChar();
        return arr;
    }
    char[][] nextArrChBorders(int rows, int columns, char border) throws IOException {
        char[][] arr = new char[rows+2][columns+2];
        for (int i=1; i<=rows; ++i)
            for (int j=1; j<=columns; ++j)
                arr[i][j] = nextNonWhitespaceChar();
        for (int i=0; i<columns+2; ++i) {
            arr[0][i] = border;
            arr[rows+1][i] = border;
        }
        for (int i=0; i<rows+2; ++i) {
            arr[i][0] = border;
            arr[i][columns+1] = border;
        }
        return arr;
    }

    void printf(String format, Object... args) throws IOException {
        outputWriter.write(String.format(format, args));
    }
    void print(Object o) throws IOException {
        outputWriter.write(o.toString());
    }
    void println(Object o) throws IOException {
        outputWriter.write(o.toString());
        outputWriter.newLine();
    }
    void print(Object... o) throws IOException {
        for (int i=0; i<o.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(o[i].toString());
        }
    }
    void println(Object... o) throws IOException {
        print(o);
        outputWriter.newLine();
    }
    void printn(Object o, int n) throws IOException {
        String s = o.toString();
        for (int i=0; i<n; ++i) {
            outputWriter.write(s);
            if (i!=n-1) outputWriter.write(' ');
        }
    }
    void printnln(Object o, int n) throws IOException {
        printn(o, n);
        outputWriter.newLine();
    }
    void printArr(int[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(Integer.toString(arr[i]));
        }
    }
    void printArr(long[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(Long.toString(arr[i]));
        }
    }
    void printArr(double[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(Double.toString(arr[i]));
        }
    }
    void printArr(String[] arr) throws IOException {
        for (int i=0; i<arr.length; ++i) {
            if (i!=0) outputWriter.write(' ');
            outputWriter.write(arr[i]);
        }
    }
    void printArr(char[] arr) throws IOException {
        for (char c: arr) outputWriter.write(c);
    }
    void printlnArr(int[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(long[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(double[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(String[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void printlnArr(char[] arr) throws IOException {
        printArr(arr);
        outputWriter.newLine();
    }
    void halt(Object... o) throws IOException {
        if (o.length!=0) println(o);
        outputWriter.flush(); outputWriter.close();
        System.exit(0);
    }

    void debug(Object... o) {
        if (showDebug) System.err.println(Arrays.deepToString(o));
    }

    public static void main(String[] args) throws Exception {
        Locale.setDefault(Locale.US);
        if (!useFiles) {
            inputReader = new InputReader(System.in, 1<<16);
            outputWriter = new BufferedWriter(new OutputStreamWriter(System.out), 1<<16);
        } else {
            inputReader = new InputReader(new FileInputStream(new File(inFile)), 1<<16);
            outputWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outFile))), 1<<16);
        }
        new C().solve();
        outputWriter.flush(); outputWriter.close();
    }
}


import java.util.*;
import java.math.*;
import java.io.*;
public class Main
	{
	public static void main(String args[])	throws IOException
		{
		Scanner c=new Scanner(System.in);
		long N=c.nextLong();
		long K=c.nextLong();
		long A[]=new long[(int)N];
		for(int i=0;i<N;i++)
			{
			A[i]=c.nextLong();
			}
		Arrays.sort(A);
		long pairs_made=0;
		for(int i=0;i<N;i++)
			{
			long count=0;
			int j=i;
			while(j<N&&A[j]==A[i])
				{
				count++;
				j++;
				}
			long new_pairs=count*N;
			if(pairs_made+new_pairs>=K)
				{
				long req=K-pairs_made;
				int loc=0;
				while(req-count>0)
					{
					req-=count;
					loc++;
					}
				System.out.println(A[i]+" "+A[loc]);
				return;
				}
			else
				pairs_made+=new_pairs;
			i=j-1;
			}
		}
	}

//must declare new classes here


import java.util.*;
import java.math.*;
import java.io.*;
public class Main
	{
	public static void main(String args[])	throws IOException
		{
		Scanner c=new Scanner(new File("C:/Users/DELL/Desktop/topCoder/topCoder/src/an"));
		long N=c.nextLong();
		long K=c.nextLong();
		long A[]=new long[(int)N];
		for(int i=0;i<N;i++)
			{
			A[i]=c.nextLong();
			}
		Arrays.sort(A);
		long pairs_made=0;
		for(int i=0;i<N;i++)
			{
			long count=0;
			int j=i;
			while(j<N&&A[j]==A[i])
				{
				count++;
				j++;
				}
			long new_pairs=count*N;
			if(pairs_made+new_pairs>=K)
				{
				long req=K-pairs_made;
				int loc=0;
				while(req-count>0)
					{
					req-=count;
					loc++;
					}
				System.out.println(A[i]+" "+A[loc]);
				return;
				}
			else
				pairs_made+=new_pairs;
			i=j-1;
			}
		}
	}

//must declare new classes here


import java.util.*;
import java.math.*;
import java.io.*;
public class Main
	{
	public static void main(String args[])	throws IOException
		{
		Scanner c=new Scanner(System.in);
		int N=c.nextInt();
		int K=c.nextInt();
		K--;
		int A[]=new int[N];
		for(int i=0;i<N;i++)
			{
			A[i]=c.nextInt();
			}
		Arrays.sort(A);
		int loc=K/N;
		int pos=K%N;
		System.out.println(A[loc]+" "+A[pos]);
		}
	}

//must declare new classes here


import java.util.*;
import java.math.*;
import java.io.*;
public class Main
	{
	public static void main(String args[])	throws IOException
		{
		Comparator<LONG> comp=new Comparator<LONG>()
			{
			@Override
			public int compare(LONG arg0, LONG arg1)
				{
				if(arg0.x<arg1.x)
					return -1;
				return 1;
				}
			};
		Scanner c=new Scanner(System.in);
		long N=c.nextLong();
		long K=c.nextLong();
		LONG A[]=new LONG[(int)N];
		for(int i=0;i<N;i++)
			{
			A[i]=new LONG();
			A[i].x=c.nextLong();
			}
		Arrays.sort(A,comp);
		long pairs_made=0;
		for(int i=0;i<N;i++)
			{
			long count=0;
			int j=i;
			while(j<N&&A[j].x==A[i].x)
				{
				count++;
				j++;
				}
			long new_pairs=count*N;
			if(pairs_made+new_pairs>=K)
				{
				long req=K-pairs_made;
				int loc=0;
				while(req-count>0)
					{
					req-=count;
					loc++;
					}
				System.out.println(A[i].x+" "+A[loc].x);
				return;
				}
			else
				pairs_made+=new_pairs;
			i=j-1;
			}
		}
	}

class LONG
	{
	long x;
	}
//must declare new classes here


import java.util.*;
import java.math.*;
import java.io.*;
public class Main
	{
	public static void main(String args[])	throws IOException
		{
		Scanner c=new Scanner(System.in);
		long N=c.nextLong();
		long K=c.nextLong();
		K--;
		long A[]=new long[(int)N];
		for(int i=0;i<N;i++)
			{
			A[i]=c.nextLong();
			}
		Arrays.sort(A);
		long loc=K/N;
		long pos=K%N;
		System.out.println(A[(int)loc]+" "+A[(int)pos]);
		}
	}

//must declare new classes here


import java.util.*;
import java.math.*;
import java.io.*;
public class Main
	{
	public static void main(String args[])	throws IOException
		{
		Comparator<LONG> comp=new Comparator<LONG>()
			{
			@Override
			public int compare(LONG arg0, LONG arg1)
				{
				if(arg0.x<arg1.x)
					return -1;
				if(arg0.x==arg1.x)
					return 0;
				return 1;
				}
			};
		Scanner c=new Scanner(System.in);
		long N=c.nextLong();
		long K=c.nextLong();
		LONG A[]=new LONG[(int)N];
		for(int i=0;i<N;i++)
			{
			A[i]=new LONG();
			A[i].x=c.nextLong();
			}
		Arrays.sort(A,comp);
		long pairs_made=0;
		for(int i=0;i<N;i++)
			{
			long count=0;
			int j=i;
			while(j<N&&A[j].x==A[i].x)
				{
				count++;
				j++;
				}
			long new_pairs=count*N;
			if(pairs_made+new_pairs>=K)
				{
				long req=K-pairs_made;
				int loc=0;
				while(req-count>0)
					{
					req-=count;
					loc++;
					}
				System.out.println(A[i].x+" "+A[loc].x);
				return;
				}
			else
				pairs_made+=new_pairs;
			i=j-1;
			}
		}
	}

class LONG
	{
	long x;
	}
//must declare new classes here


import java.util.*;
import java.math.*;
import java.io.*;
public class t1
{
public static void main(String args[])	throws IOException
	{
	Scanner c=new Scanner(System.in);
	int N=c.nextInt();
	Comparator<pair> comp=new Comparator<pair>()
		{
		public int compare(pair p0, pair p1)
			{
			if(p0.x<p1.x)
				return -1;
			if(p0.x==p1.x)
				{
				if(p0.y==p1.y)
					return 0;
				if(p0.y<p1.y)
					return -1;
				}
			return 1;
			}
		};
	pair P[]=new pair[N*N];
	long K=c.nextLong();
	int A[]=new int[N];
	for(int i=0;i<N;i++)
		{
		A[i]=c.nextInt();
		}
	for(int i=0;i<N;i++)
		{
		for(int j=0;j<N;j++)
			{
			P[N*i+j]=new pair();
			P[N*i+j].x=A[i];
			P[N*i+j].y=A[j];
			}
		}
	Arrays.sort(P,comp);
	System.out.println(P[(int)(K-1)].x+" "+P[(int)(K-1)].y);
	}
}

class pair
	{
	int x;
	int y;
	}

//must declare new classes here


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ProblemC {
    public static void main(String[] args) throws IOException {
        BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
        String[] data = s.readLine().split(" ");
        int n = Integer.valueOf(data[0]);
        long k = Long.valueOf(data[1]) - 1;
        long[] a = new long[n];

        String[] nu = s.readLine().split(" ");
        for (int i = 0 ; i < n ; i++) {
            a[i] = Long.valueOf(nu[i]);
        }
        for (int i = 0 ; i < n ; i++) {
            int idx = (int)(Math.random() * n);
            long tmp = a[i];
            a[i] = a[idx];
            a[idx] = tmp;
        }

        Arrays.sort(a);

        long[] nums = new long[n];
        int idx = 0;
        long[] nlist = new long[n];
        int nidx = 0;
        int z = 0;
        while (z < n) {
            int cnt = 0;
            long val = a[z];
            while (z < n && a[z] == val) {
                z++;
                cnt++;
            }
            nums[idx++] = cnt;
            nlist[nidx++] = val;
        }

        int fidx = 0;
        int sidx = 0;
        while (k >= n * nums[fidx]) {
            k -= n * nums[fidx];
            fidx++;
        }
        long mul = nums[fidx];
        while (true) {
            k -= mul * nums[sidx];
            if (k < 0) {
                break;
            }
            sidx++;
        }
        System.out.println(nlist[fidx] + " " + nlist[sidx]);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ProblemC {

    public static void main(String[] args) throws IOException {
        BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
        String[] data = s.readLine().split(" ");
        int n = Integer.valueOf(data[0]);
        long k = Long.valueOf(data[1]) - 1;
        long[] a = new long[n];

        String[] nu = s.readLine().split(" ");
        for (int i = 0 ; i < n ; i++) {
            a[i] = Long.valueOf(nu[i]);
        }
        Arrays.sort(a);

        long[] nums = new long[n];
        int idx = 0;
        Map<Long, Integer> nmap = new HashMap<Long, Integer>();
        List<Long> nlist = new ArrayList<Long>();
        int z = 0;
        while (z < n) {
            int cnt = 0;
            long val = a[z];
            while (z < n && a[z] == val) {
                z++;
                cnt++;
            }
            nums[idx] = cnt;
            nmap.put(val, cnt);
            nlist.add(val);
            idx++;
        }

        int fidx = 0;
        int sidx = 0;
        while (k >= n * nums[fidx]) {
            k -= n * nums[fidx];
            fidx++;
        }
        long mul = nums[fidx];
        while (true) {
            k -= mul * nums[sidx];
            if (k < 0) {
                break;
            }
            sidx++;
        }
        System.out.println(nlist.get(fidx) + " " + nlist.get(sidx));
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ProblemC {
    public static void main(String[] args) throws IOException {
        BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
        String[] data = s.readLine().split(" ");
        int n = Integer.valueOf(data[0]);
        long k = Long.valueOf(data[1]) - 1;
        long[] a = new long[n];

        String[] nu = s.readLine().split(" ");
        for (int i = 0 ; i < n ; i++) {
            a[i] = Long.valueOf(nu[i]);
        }
        Arrays.sort(a);

        long[] nums = new long[n];
        int idx = 0;
        long[] nlist = new long[n];
        int nidx = 0;
        int z = 0;
        while (z < n) {
            int cnt = 0;
            long val = a[z];
            while (z < n && a[z] == val) {
                z++;
                cnt++;
            }
            nums[idx++] = cnt;
            nlist[nidx++] = val;
        }

        int fidx = 0;
        int sidx = 0;
        while (k >= n * nums[fidx]) {
            k -= n * nums[fidx];
            fidx++;
        }
        long mul = nums[fidx];
        while (true) {
            k -= mul * nums[sidx];
            if (k < 0) {
                break;
            }
            sidx++;
        }
        System.out.println(nlist[fidx] + " " + nlist[sidx]);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ProblemC {

    public static void main(String[] args) throws IOException {
        BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
        String[] data = s.readLine().split(" ");
        int n = Integer.valueOf(data[0]);
        long k = Long.valueOf(data[1]) - 1;
        long[] a = new long[n];

        String[] nu = s.readLine().split(" ");
        for (int i = 0 ; i < n ; i++) {
            a[i] = Long.valueOf(nu[i]);
        }
        Arrays.sort(a);

        long[] nums = new long[n];
        int idx = 0;
        List<Long> nlist = new ArrayList<Long>();
        int z = 0;
        while (z < n) {
            int cnt = 0;
            long val = a[z];
            while (z < n && a[z] == val) {
                z++;
                cnt++;
            }
            nums[idx] = cnt;
            nlist.add(val);
            idx++;
        }

        int fidx = 0;
        int sidx = 0;
        while (k >= n * nums[fidx]) {
            k -= n * nums[fidx];
            fidx++;
        }
        long mul = nums[fidx];
        while (true) {
            k -= mul * nums[sidx];
            if (k < 0) {
                break;
            }
            sidx++;
        }
        System.out.println(nlist.get(fidx) + " " + nlist.get(sidx));
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ProblemC {

    public static void main(String[] args) throws IOException {
        BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
        String[] data = s.readLine().split(" ");
        int n = Integer.valueOf(data[0]);
        long k = Long.valueOf(data[1]) - 1;
        long[] a = new long[n];

        String[] nu = s.readLine().split(" ");
        for (int i = 0 ; i < n ; i++) {
            a[i] = Long.valueOf(nu[i]);
        }
        Arrays.sort(a);

        long[] nums = new long[n];
        int idx = 0;
        Map<Long, Integer> nmap = new HashMap<Long, Integer>();
        List<Long> nlist = new ArrayList<Long>();
        int z = 0;
        while (z < n) {
            int cnt = 0;
            long val = a[z];
            while (z < n && a[z] == val) {
                z++;
                cnt++;
            }
            nums[idx] = cnt;
            nmap.put(val, cnt);
            nlist.add(val);
            idx++;
        }

        int fidx = 0;
        int sidx = 0;
        while (k > n * nums[fidx]) {
            k -= n * nums[fidx];
            fidx++;
        }
        long mul = nums[fidx];
        while (true) {
            k -= mul * nums[sidx];
            if (k < 0) {
                break;
            }
            sidx++;
        }
        System.out.println(nlist.get(fidx) + " " + nlist.get(sidx));
    }
}


import java.util.*;
import java.io.*;

public class test2
{
	public static void main(String[] args)
	{
		new test().run();
	}

	void run()
	{
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int n = in.nextInt();
		long k = in.nextLong() - 1;

		long[] arr = new long[n];
		for (int i = 0; i < n; i++)
			arr[i] = in.nextLong();

		Arrays.sort(arr);

		int x = (int) (k / n);

		int start = x;
		int end = x;

		while (start > 0 && arr[start - 1] == arr[x])
			start--;

		while (end < n - 1 && arr[end + 1] == arr[x])
			end++;

		k -= n * start;
		int total = end - start + 1;
		int y = (int) (k / total);

		out.println(arr[x] + " " + arr[y]);
		out.close();
	}
}


import java.util.*;
import java.io.*;

public class test
{
	public static void main(String[] args)
	{
		new test().run();
	}

	void run()
	{
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		long n = in.nextLong();
		long k = in.nextLong() - 1;

		long[] arr = new long[(int) n];
		for (long i = 0; i < n; i++)
			arr[(int) i] = in.nextLong();

		Arrays.sort(arr);

		long x = k / n;
		long y = k % n;

		out.println(arr[(int) x] + " " + arr[(int) y]);
		out.close();
	}
}


import java.util.*;
import java.io.*;

public class test
{
	public static void main(String[] args)
	{
		new test().run();
	}

	void run()
	{
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int n = in.nextInt();
		long k = in.nextLong() - 1;

		long[] arr = new long[n];
		for (int i = 0; i < n; i++)
			arr[i] = in.nextLong();

		Arrays.sort(arr);

		int x = (int) (k / n);

		int start = x;
		int end = x;

		while (start > 0 && arr[start - 1] == arr[x])
			start--;

		while (end < n - 1 && arr[end + 1] == arr[x])
			end++;

		k -= n * start;
		int total = end - start + 1;
		int y = (int) (k / total);

		out.println(arr[x] + " " + arr[y]);
		out.close();
	}
}


import java.io.*;
import java.util.*;

public class test2
{

	public static void main(String[] args) throws Exception
	{
		PrintWriter out = new PrintWriter(System.out, true);
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(in.readLine());
		// Scanner s = new Scanner(System.in);
		long n = Long.parseLong(st.nextToken());
		long k = Long.parseLong(st.nextToken());
		int start1 = (int) ((k - 1) / n);
		int cnt = 0;
		int cntsmall = 0;

		st = new StringTokenizer(in.readLine());
		int[] mas = new int[(int) n];
		for (int i = 0; i < n; i++)
		{
			mas[i] = Integer.parseInt(st.nextToken());
		}
		int c = mas[0];
		mas[0] = mas[(int) n - 1];
		mas[(int) n - 1] = c;
		Arrays.sort(mas);
		for (int i = 0; i < n; i++)
		{
			if (mas[i] == mas[start1])
				cnt++;
			if (mas[i] < mas[start1])
				cntsmall++;
		}
		out.println(mas[start1] + " "
				+ mas[(int) ((k - 1 - cntsmall * n) / cnt)]);
	}

}


#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
#define loop(i,n)   for(int i=0;i<(int)(n);i++)
#define GCC_go ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stop system("pause");
#define F first
#define S second
typedef long long ll;
#define fx fixed
#define setp(n) setprecision(n)
#define PI 3.14159
typedef complex<double> point;
typedef pair<point, point> segment;
typedef pair<double, point> circle;
typedef vector<point> polygon;
template <class T>inline void arin(T* st, T* nd) {
    while (st < nd)cin>>*st++;
}

int di[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dj[] = {0, 0, 1, -1, 1, -1, -1, 1};
int diK[] = {-2, -2, -1, 1, 2, 2, 1, -1};
int djK[] = {-1, 1, 2, 2, 1, -1, -2, -2};
bool cmd(pair<int, int>a, pair<int, int>b) {return (a.S < b.S);}

ll n,m,q;
map<string,int>inps;
map<pair<string,string>,int>mp;
struct query{

    string sn;
    ll num;

    query(string s,ll o):sn(s),num(o){};

};

int main(){
    int mx=-1,p=0,n,a,b,c,d;
    cin>>n;
    loop(i,n){
        cin>>a>>b>>c>>d;
        if(mx<(a+b+c+d))
            mx=a+b+c+d,p=i+1;
    }
    cout<<p;

}


#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
#define loop(i,n)   for(int i=0;i<(int)(n);i++)
#define GCC_go ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stop system("pause");
#define F first
#define S second
typedef long long ll;
#define fx fixed
#define setp(n) setprecision(n)
#define PI 3.14159
typedef complex<double> point;
typedef pair<point, point> segment;
typedef pair<double, point> circle;
typedef vector<point> polygon;
template <class T>inline void arin(T* st, T* nd) {
    while (st < nd)cin>>*st++;
}

int di[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dj[] = {0, 0, 1, -1, 1, -1, -1, 1};
int diK[] = {-2, -2, -1, 1, 2, 2, 1, -1};
int djK[] = {-1, 1, 2, 2, 1, -1, -2, -2};
bool cmd(pair<int, int>a, pair<int, int>b) {return (a.F< b.F);}
bool cmdd(pair<int, int>a, pair<int, int>b) {
    if(a.F==b.F)
        return a.S<b.S;
    return (a.F < b.F);
}

ll n,m,q;

struct query{

    string sn;
    ll num;

    query(string s,ll o):sn(s),num(o){};

};

int main(){
    int mx=-1,p=0,n,a,b,c,d;
    vector< pair<int,int> >inp;

    cin>>n;
    loop(i,n){
        cin>>a>>b>>c>>d;
        if(!i)mx=a+b+c+d;
        inp.push_back({a+b+c+d,i+1});

    }
   sort(inp.begin(),inp.end(),cmd);
    sort(inp.begin(),inp.end(),cmdd);

    int qq=-1,sum=-1;
   /* loop(i,n){
        cout<<inp[i].F<<" "<<inp[i].S<<endl;

        if(inp[i].F>mx){
            return cout<<n-i,0;}

}*/
    cout<<inp[n-1].S;
}


#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
#define loop(i,n)   for(int i=0;i<(int)(n);i++)
#define GCC_go ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stop system("pause");
#define F first
#define S second
typedef long long ll;
#define fx fixed
#define setp(n) setprecision(n)
#define PI 3.14159
typedef complex<double> point;
typedef pair<point, point> segment;
typedef pair<double, point> circle;
typedef vector<point> polygon;
template <class T>inline void arin(T* st, T* nd) {
    while (st < nd)cin>>*st++;
}

int di[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dj[] = {0, 0, 1, -1, 1, -1, -1, 1};
int diK[] = {-2, -2, -1, 1, 2, 2, 1, -1};
int djK[] = {-1, 1, 2, 2, 1, -1, -2, -2};
bool cmd(pair<int, int>a, pair<int, int>b) {

     if(a.F==b.F)
        return a.S<b.S;

    return (a.F< b.F);}
bool cmdd(pair<int, int>a, pair<int, int>b) {

}

ll n,m,q;

struct query{

    string sn;
    ll num;

    query(string s,ll o):sn(s),num(o){};

};

int main(){
    int mx=-1,p=0,n,a,b,c,d;
    vector< pair<int,int> >inp;

    cin>>n;
    loop(i,n){
        cin>>a>>b>>c>>d;
        if(!i)mx=a+b+c+d;
        inp.push_back({a+b+c+d,i+1});

    }
   sort(inp.rbegin(),inp.rend(),cmd);

       return cout<<inp[0].S,0;

}


#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
#define loop(i,n)   for(int i=0;i<(int)(n);i++)
#define GCC_go ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define stop system("pause");
#define F first
#define S second
typedef long long ll;
#define fx fixed
#define setp(n) setprecision(n)
#define PI 3.14159
typedef complex<double> point;
typedef pair<point, point> segment;
typedef pair<double, point> circle;
typedef vector<point> polygon;
template <class T>inline void arin(T* st, T* nd) {
    while (st < nd)cin>>*st++;
}

int di[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dj[] = {0, 0, 1, -1, 1, -1, -1, 1};
int diK[] = {-2, -2, -1, 1, 2, 2, 1, -1};
int djK[] = {-1, 1, 2, 2, 1, -1, -2, -2};
bool cmd(pair<int, int>a, pair<int, int>b) {return (a.F > b.F);}
bool cmdd(pair<int, int>a, pair<int, int>b) {return (a.F < b.F);}

ll n,m,q;

struct query{

    string sn;
    ll num;

    query(string s,ll o):sn(s),num(o){};

};

int main(){
    int mx=-1,p=0,n,a,b,c,d;
    vector< pair<int,int> >inp;
    set<int>su;
    cin>>n;
    loop(i,n){
        cin>>a>>b>>c>>d;
        inp.push_back({a+b+c+d,i+1});
        su.insert(a+b+c+d);
    }
    if(su.size()==n)
    sort(inp.begin(),inp.end(),cmdd);
    else  sort(inp.begin(),inp.end(),cmd);
    loop(i,n)
    if(inp[i].S==1)
        return cout<<i+1,0;

}


#include<iostream>
using namespace std;
void swap(int &a,int &b){
	int temp=a;
	a=b;
	b=temp;
}
void sort(int a[],int s[],int n){
	if(n==1)
		return;
	int max=0;
	int maxindex;
	for(int i=0;i<n;i++){
		if(max<a[i]){
			max=a[i];
			maxindex=i;
		}
	}
	swap(a[maxindex],a[n-1]);
	swap(s[maxindex],s[n-1]);
	return sort(a,s,n-1);
}
int main(){
	int n;
	cin>>n;
	int a[n];
	int s[n];
	for(int i=0;i<n;i++){
		int x,y,z,t;
		cin>>x>>y>>z>>t;
		a[i]=x+y+z+t;
		s[i]=i+1;
	}
	sort(a,s,n);
	for(int i=0;i<n;i++){
		if(s[i]==1){
			cout<<n-i;
			break;
		}
	}
}


#include<iostream>
using namespace std;
void swap(int &a,int &b){
	long int temp=a;
	a=b;
	b=temp;
}
void sort(int a[],int s[],int n){
	if(n==1)
		return;
	int max=0;
	int maxindex;
	for(int i=0;i<n;i++){
		if(max<a[i]){
			max=a[i];
			maxindex=i;
		}
	}
	swap(a[maxindex],a[n-1]);
	swap(s[maxindex],s[n-1]);
	return sort(a,s,n-1);
}
int main(){
	int n;
	cin>>n;
	int a[n];
	int s[n];
	for(int i=0;i<n;i++){
		int x,y,z,t;
		cin>>x>>y>>z>>t;
		a[i]=x+y+z+t;
		s[i]=i+1;
	}
	sort(a,s,n);
	for(int i=0;i<n;i++){
		if(s[i]==1){
			cout<<n-i;
			break;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n];
	int our=0;
	for(int i=0;i<n;i++){
		int x,y,z,u;
		cin>>x>>y>>z>>u;
		a[i]=x+y+z+y;
		if(i==0)
			our=a[i];
	}
	sort(a,a+n);
	int ans=0;
	for(int i=0;i<n;i++)
		if(a[i]<our){
			ans++;
		}
	cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int x,y,z,u;
	cin>>x>>y>>z>>u;
	int our=x+y+z+u;
	int ans=1;
	for(int i=1;i<n;i++){
		cin>>x>>y>>z>>u;
		if(x+y+z+u>our)
			ans++;
	}
	cout<<ans;
}


#include<iostream>
using namespace std;
void swap(int &a,int &b){
	long long int temp=a;
	a=b;
	b=temp;
}
void sort(int a[],int s[],int n){
	if(n==1)
		return;
	long long int max=0;
	long long int maxindex;
	for(int i=0;i<n;i++){
		if(max<a[i]){
			max=a[i];
			maxindex=i;
		}
	}
	swap(a[maxindex],a[n-1]);
	swap(s[maxindex],s[n-1]);
	return sort(a,s,n-1);
}
int main(){
	int n;
	cin>>n;
	long long int a[n];
	long long int s[n];
	for(int i=0;i<n;i++){
		int x,y,z,t;
		cin>>x>>y>>z>>t;
		a[i]=x+y+z+t;
		s[i]=i+1;
	}
	sort(a,s,n);
	for(int i=0;i<n;i++){
		if(s[i]==1){
			cout<<n-i;
			break;
		}
	}
}


#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <stack>
#include <map>
using namespace std;
int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
	int n;
	cin >> n;
	vector<pair<int, int>> a;
	int pointsOf = 0;
	for (int i = 0; i < n; i++) {
		int sum = 0;
		for (int j = 0; j < 3; j++) {
			int temp;
			cin >> temp;
			sum += temp;
		}
		a.push_back({ sum,-(i + 1)});
	}
	sort(a.rbegin(), a.rend());
	for (int i = 0; i < n; i++) {
		if (a[i].second == -1) {
			cout << i;
			return 0;
		}
	}
//	system("pause");
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <stack>
#include <map>
using namespace std;

bool cmp(pair<int, int> a, pair<int, int> b) {
	return a.first < b.first || a.first == b.first && a.second > b.second;
}

int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
	int n;
	cin >> n;
	vector<pair<int, int>> a;
	int pointsOf = 0;
	for (int i = 0; i < n; i++) {
		int sum = 0;
		for (int j = 0; j < 4; j++) {
			int temp;
			cin >> temp;
			sum += temp;
		}
		a.push_back({sum, i + 1});
	}
	sort(a.rbegin(), a.rend(),cmp);
	for (int i = 0; i < n; i++) {
		if (a[i].second == 1) {
			cout << i + 1;
		}
	}
	cout << endl;
//	system("pause");
	return 0;
}


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

int main() {
    int n,z = 0,m=1;
    cin >> n;
    int a,b,c,d,k;
    cin >>a>>b>>c>>d;
    z=a+b+c+d;
    for (int i =2; i<(n+1); i++){
        cin >>a>>b>>c>>d;
        k=a+b+c+d;
        if(z<k){
            z = k;
            m +=1;
        }
    }
    cout << m;
  return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <stack>
#include <map>
using namespace std;
bool cmp(pair<int, int> a, pair<int, int> b) {
	return a.first < b.first || a.first == b.first && a.second > b.second;
}

int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
	int n;
	cin >> n;
	vector<pair<int, int>> a;
	int pointsOf = 0;
	for (int i = 0; i < n; i++) {
		int sum = 0;
		for (int j = 0; j < 3; j++) {
			int temp;
			cin >> temp;
			sum += temp;
		}
		a.push_back({ sum,i + 1});
	}
	sort(a.rbegin(), a.rend(),cmp);
	for (int i = 0; i < n; i++) {
		if (a[i].second == 1) {
			cout << i;
			return 0;
		}
	}
//	system("pause");
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <stack>
#include <map>
using namespace std;
int main() {
//	freopen("input.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
	int n;
	cin >> n;
	vector<int> a(n-1);
	int pointsOf = 0;
	for (int j = 0; j < 3; j++) {
		int temp;
		cin >> temp;
		pointsOf += temp;
	}
	for (int i = 0; i < n - 1; i++) {
		int sum = 0;
		for (int j = 0; j < 3; j++) {
			int temp;
			cin >> temp;
			sum += temp;
		}
		a[i] = sum;
	}
	sort(a.rbegin(), a.rend());
	for (int i = 0; i < a.size(); i++) {
		if (pointsOf >= a[i]) {
			cout << i;
			return 0;
		}
	}
	cout << n;
//	system("pause");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;//
int main() {
	int ans;
	int sum;
	int n;
	cin >> n;
	int a , b , c , d;
	cin >> a >> b >> c >> d;
	sum = a + b + c + d;
	for (int i = 2; i <= n; i++) {
		cin >> a >> b >> c >> d;
		if (a + b + c + d > sum){
			ans++;
		}
	}
	cout << ans + 1;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main() {
	int ans = 1;
	int sum;
	int n;
	cin >> n;
	int a , b , c , d;
	cin >> a >> b >> c >> d;
	sum = a + b + c + d;
	for (int i = 2; i < n; i++) {
		cin >> a >> b >> c >> d;
		if (a + b + c + d < sum){
			ans++;
		}
	}
	cout << ans;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main() {
	int ans;
	int sum;
	int n;
	cin >> n;
	int a , b , c , d;
	cin >> a >> b >> c >> d;
	sum = a + b + c + d;
	for (int i = 2; i <= n; i++) {
		cin >> a >> b >> c >> d;
		if (a + b + c + d > sum){
			ans++;
		}
	}
	cout << ans + 1;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
	cin >> n;
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int SUM = a + b + c + d;
	int ans = 0;
	for (int i = 2; i <= n; i++) {
	    cin >> a >> b >> c >> d;
	    if (a + b + c + d > SUM) {
	        ans++;
	    }
	}
	cout << ans + 1;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main() {
	int ans;
	int sum;
	int n;
	cin >> n;
	int a , b , c , d;
	cin >> a >> b >> c >> d;
	sum = a + b + c + d;
	for (int i = 2; i < n; i++) {
		cin >> a >> b >> c >> d;
		if (a + b + c + d > sum){
			ans++;
		}
	}
	cout << ans + 1;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int ara[10001];
bool func(int a, int b)
{
    return a > b;
}
int main()
{
    int a,sum=0,x,p;
    cin>>a;
    int array[4];
        for(int i=1; i<=a; i++)
        {
            sum=0;
            for(int i=0; i<4; i++)
            {
                cin>>array[i];
                sum= sum+array[i];
            }
            ara[i]=sum;

        }
         x = ara[1];
        sort(ara+1,ara+(a+1), func);
        for(int i=1;i<=a;i++)
        {
        //cout<<ara[i]<<" ";
            if(x==ara[i])
            {
                p=i;
                //break;
            }
        }
        if(a==1)
        {
            //cout<<endl;
            cout<<"1"<<endl;
        }
        else
        {
            //cout<<endl;
            cout<<p<<endl;
        }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,sum=0,p=1,q=1;
    cin>>a;
    int array[4];
        for(int i=1; i<=a; i++)
        {
            sum=0;
            for(int i=0; i<4; i++)
            {
                cin>>array[i];
                sum= sum+array[i];
            }
            if(sum>p)
            {
                p=sum;
                q=i;
            }
        }

    cout<<q<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,p=0,q;
    cin>>n;
    int E[n],G[n],M[n],H[n],sum[n];
    for(int i=0;i<n;i++)
    {
        cin>>E[i]>>G[i]>>M[i]>>H[i];
        sum[i]= E[i]+G[i]+M[i]+H[i];
        if(sum[i]>p)
        {
            p=sum[i];
            q = i+1;
        }
    }
    cout<<q<<endl;

return 0;
}


#include<bits/stdc++.h>
using namespace std;
int ara[10001];
bool func(int a, int b)
{
    return a > b;
}
int main()
{
    int a,sum=0,x,p;
    cin>>a;
    int array[4];
        for(int i=1; i<=a; i++)
        {
            sum=0;
            for(int i=0; i<4; i++)
            {
                cin>>array[i];
                sum= sum+array[i];
            }
            ara[i]=sum;

        }
         x = ara[1];
        sort(ara+1,ara+(a+1), func);
        for(int i=0;i<=a;i++)
        {
        //cout<<ara[i]<<" ";
            if(x==ara[i])
            {
                p=i;
                break;
            }
        }
        if(a==1)
        {
            //cout<<endl;
            cout<<"1"<<endl;
        }
        else
        {
            //cout<<endl;
            cout<<p<<endl;
        }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,p=0,q=0;
    cin>>n;
    int E[n],G[n],M[n],H[n],sum[n];
    for(int i=0;i<n;i++)
    {
        cin>>E[i]>>G[i]>>M[i]>>H[i];
        sum[i]= E[i]+G[i]+M[i]+H[i];
        cout<<sum[i]<<endl;
        if(sum[i]>=p)
        {
            p=sum[i];
            q = i;
        }

    }
    cout<<q+1<<endl;

return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,p=0,q=0;
    cin>>n;
    int E[n],G[n],M[n],H[n],sum[n];
    for(int i=0;i<n;i++)
    {
        cin>>E[i]>>G[i]>>M[i]>>H[i];
        sum[i]= E[i]+G[i]+M[i]+H[i];

        if(sum[i]>=p)
        {
            p=sum[i];
            q = i;
        }

    }
    cout<<q+1<<endl;

return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,sum=0,p=0,q;
    cin>>a;
    int array[4];
    for(int i=1; i<=a; i++)
    {
        sum=0;
        for(int i=0; i<4; i++)
        {
            cin>>array[i];
            sum= sum+array[i];
        }
        if(sum>=p)
        {
            p=sum;
            q=i;
        }
    }
    cout<<q<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,sum=0,p=0,q;
    cin>>a;
    int array[4];
    for(int i=1; i<=a; i++)
    {
        sum=0;
        for(int i=0; i<4; i++)
        {
            cin>>array[i];
            sum= sum+array[i];
        }
        if(sum>p)
        {
            p=sum;
            q=i;
        }
    }
    cout<<q<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int ara[10001];
bool func(int a, int b)
{
    return a > b;
}
int main()
{
    int a,sum=0,x,p;
    cin>>a;
    int array[4];
        for(int i=1; i<=a; i++)
        {
            sum=0;
            for(int i=0; i<4; i++)
            {
                cin>>array[i];
                sum= sum+array[i];
            }
            ara[i]=sum;

        }
         x = ara[1];
        sort(ara+1,ara+a, func);
        for(int i=1;i<=a;i++)
        {
            //cout<<ara[i]<<" ";
            if(x==ara[i])
            {
                p=i;
                break;
            }
        }
        if(a==1)
        {
            //cout<<endl;
            cout<<"1"<<endl;
        }
        else
        {
            cout<<p<<endl;
        }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int ara[10001];
bool func(int a, int b)
{
    return a > b;
}
int main()
{
    int a,sum=0,x,p;
    cin>>a;
    int array[4];
        for(int i=1; i<=a; i++)
        {
            sum=0;
            for(int i=0; i<4; i++)
            {
                cin>>array[i];
                sum= sum+array[i];
            }
            ara[i]=sum;

        }
         x = ara[1];
        sort(ara+1,ara+(a+1), func);
        for(int i=0;i<=a;i++)
        {
        //cout<<ara[i]<<" ";
            if(x==ara[i])
            {
                p=i;
                break;
            }
        }
        if(a==1||sum==0)
        {
            //cout<<endl;
            cout<<"1"<<endl;
        }
        else
        {
            //cout<<endl;
            cout<<p<<endl;
        }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	long long i,k,m,ara[2000],a=1;
	long long sum1=0,a1,a2,a3,a4;

	cin >> m;

    cin >> a1 >> a2 >> a3 >> a4;
    sum1+=a1+a2+a3+a4;

	for(i=0; i<(m-1); i++)
	{

		cin >> a1 >> a2 >> a3 >> a4;
		k=a1+a2+a3+a4;

		if(k>sum1){
            a++;
		}
	}

	cout << a << endl;

	return 0;

}


#include<stdio.h>
#include<iostream>
using namespace std;

int main()
{
	int a,b,c,d,n;
	int k;
	cin >> n;

	for(int i=1; i<=n; i++){
		cin >> a >> b >> c;
	d=a-b-c;
	k=abs(d);

	if(d==0 && a>=k){
		printf("Case  %d: %d\n", i, a);
	}
	else	if(d<0 && a>=k){
		printf("Case  %d: %d\n", i, abs(d));
	}
		else if(d>0 && a>=k){
		printf("Case  %d: %d\n", i, a-d);
	}
	else if(d<0 && a<k){
		printf("Case %d: %d\n", i, (c%a)+b);
	}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,id[100]={0},a,b,c,d,u=0;
    cin>>n;
    int max=id[0];
    for(i=1;i<=n;i++)
    {
        cin>>a>>b>>c>>d;
        id[i]=a+b+c+d;
        if(max<id[i])
        {
            max=id[i];
            id[i]=max;
            u=i;
        }
    }
    cout<<u<<endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	long long i,k,m,ara[2000],a=0,aa=-1,j=0,b=0;
	long long sum1=0,a1,a2,a3,a4;

	cin >> m;

	while(m--)
	{

		cin >> a1 >> a2 >> a3 >> a4;
		sum1=a1+a2+a3+a4;

		ara[j]=sum1;

		if(ara[j]>aa){
			aa=ara[j];
			a=j+1;
		}

		j++;
		sum1=0;

	}

	cout << a << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	long long i,k,m,ara[200],a=0,aa=-1,j=0,b=0;
	long long sum1=0;

	cin >> m;

	while(m--)
	{
		for(i=0; i<4; i++)
		{
			cin >> k;
			sum1+=k;
		}
		ara[j]=sum1;
		if(ara[j]>aa){
			aa=ara[j];
			a++;
		}
		j++;
		sum1=0;

	}

	cout << a << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
	long long i,k,m,ara[2000],a=0,aa=-1,j=0,b=0;
	long long sum1=0;

	cin >> m;

	while(m--)
	{
		for(i=0; i<4; i++)
		{
			cin >> k;
			sum1+=k;
		}
		ara[j]=sum1;
		if(ara[j]>aa){
			aa=ara[j];
			a++;
		}
		j++;
		sum1=0;

	}

	cout << a << endl;

	return 0;

}


#include<bits/stdc++.h>
using namespace std;
int arr[1007];
int main()
{
long long n, a, b, c, d, x=0, cnt=0;
cin>>n;
for(long long i=0 ; i<n ; i++){
cin>>a>>b>>c>>d;
int s=a+b+c+d;
if(i==0) x=s;
else if(s>x) cnt++;
    }
cout<<cnt;
}


#include<bits/stdc++.h>
using namespace std;
int arr[1007];
int main()
{
long long n, a, b, c, d, x;
cin>>n;
for(long long i=0 ; i<n ; i++){
cin>>a>>b>>c>>d;
s=a+b+c+d;
if(i==0) x=s;
else if(s>x) c++;
    }
cout<<c;
}


#include<bits/stdc++.h>
using namespace std;
int arr[1007];
int main()
{
long long n, a, b, c, d, x;
cin>>n;
for(long long i=0 ; i<n ; i++){
cin>>a>>b>>c>>d;
if(i==0)x=a+b+c+d;
arr[i]=a+b+c+d;
}
sort(arr, arr+n);
for(int i=0 ; i<n ; i++)
if(arr[i]==x){cout<<i; break;}

}


#include<bits/stdc++.h>
using namespace std;
int arr[1007];
int main()
{
long long n, a, b, c, d, x, cnt=0;
cin>>n;
for(long long i=0 ; i<n ; i++){
cin>>a>>b>>c>>d;
int s=a+b+c+d;
if(i==0) x=s;
else if(s>x) cnt++;
    }
cout<<cnt;
}


#include<bits/stdc++.h>
using namespace std;
int arr[1007];
int main()
{
long long n, a, b, c, d, x=0, cnt=1;
cin>>n;
for(long long i=0 ; i<n ; i++){
cin>>a>>b>>c>>d;
int s=a+b+c+d;
if(i==0) x=s;
else if(s>x) cnt++;
    }
cout<<cnt;
}


#include<bits/stdc++.h>
using namespace std;
int arr[1007];
int main()
{
long long n, a, b, c, d, x, cnt=0;
cin>>n;
for(long long i=0 ; i<n ; i++){
cin>>a>>b>>c>>d;
int s=a+b+c+d;
if(i==0) x=s;
else if(s>x) cnt++;
    }
cout<<c;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;
    int a,b,c,d;
    int score = -1,id;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a>>b>>c>>d;
        if(a+b+c+d > score) {
            score = a+b+c+d;
            id = i+1;
        }
    }
    cout<<id;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;
    int a,b,c,d;
    int score = 0,id;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a>>b>>c>>d;
        if(a+b+c+d > score) {
            score = a+b+c+d;
            id = i+1;
        }
    }
    cout<<id;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;
    int a,b,c,d;
    int score = -1,id;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a>>b>>c>>d;
        if((a+b+c+d) >= score) {
            score = a+b+c+d;
            id = i+1;
        }
    }
    cout<<id;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;
    int a,b,c,d;
    int score , rank=1;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a>>b>>c>>d;
        if(i==0) score = a+b+c+d;
        if((a+b+c+d) > score) {
            rank++;
        }
    }
    cout<<rank;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int n;
    int a,b,c,d;
    int score = 0,id=-1;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a>>b>>c>>d;
        if(a+b+c+d > score) {
            score = a+b+c+d;
            id = i+1;
        }
    }
    cout<<id;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define sz(s) s.size()

int main(){
  int n;
  cin >> n;
  int a[4],sum[n] = {};
  int maxi = 0,ans;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < 4; j++){
      cin >> a[j];
      sum[i] += a[j];
    }
    if(sum[i] > maxi){
      maxi = sum[i];
      ans = i + 1;
    }
  }
  cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define sz(s) s.size()

int main(){
  bool f = false;
  int n,a;
  cin >> n;
  int sum[n] = {}, b[n] = {};
  for(int i = 0; i < n; i++){
    for(int j = 0; j < 4; j++){
      cin >> a;
      sum[i] += a;
      b[i] += a;
    }
    cout << ' ' << sum[i] << ' ' << b[i] << endl;
  }
  sort(b, b + n);
  for(int j = 0; j < n / 2; j++){
    swap(b[j], b[n - j - 1]);
  }
  for(int j = 0; j < n; j++){
    if(b[j] == sum[0]){
      cout << j + 1;
      f = true;
      return 0;
    }
  }
  if(!f){
    cout << 1;
  }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define sz(s) s.size()

int main(){
  bool f = false;
  int n,a;
  cin >> n;
  int sum[n] = {}, b[n] = {};
  for(int i = 0; i < n; i++){
    for(int j = 0; j < 4; j++){
      cin >> a;
      sum[i] += a;
      b[i] += a;
    }
    // cout << ' ' << sum[i] << ' ' << b[i] << endl;
  }
  sort(b, b + n);
  for(int j = 0; j < n / 2; j++){
    swap(b[j], b[n - j - 1]);
  }
  for(int j = 0; j < n; j++){
    if(b[j] == sum[0]){
      cout << j + 1;
      f = true;
      return 0;
    }
  }
  if(!f){
    cout << 1;
  }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define sz(s) s.size()

int main(){
  int n;
  cin >> n;
  int a[4],sum[n] = {};
  int maxi = 0,ans = 1;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < 4; j++){
      cin >> a[j];
      sum[i] += a[j];
    }
    if(sum[i] > maxi){
      maxi = sum[i];
      ans = i + 1;
    }
  }
  cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define sz(s) s.size()

int main(){
  int n;
  cin >> n;
  int a[4],sum[n] = {};
  int maxi = 0,ans = 0;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < 4; j++){
      cin >> a[j];
      sum[i] += a[j];
    }
    if(sum[i] >= maxi){
      maxi = sum[i];
      ans = i + 1;
    }
  }
  cout << ans;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
 long n ,a,b,c,d,sum=0,x=0,mx=0;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a>>b>>c>>d;
cout<<" Sum = "<<sum<< "  mx = "<<mx<<endl;
sum=a+b+c+d;
if(sum>=mx){
mx=sum;
x=i+1;
}
}
cout<<x<<endl;

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n ,a,b,c,d,sum[1001],x=0,mx=0;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>a>>b>>c>>d;
        if(i==0)
            mx=a+b+c+d;

        sum[i]=a+b+c+d;
    }
    sort(sum,sum+n+1);
    for(int i=0; i<n; i++)
    {
        if(sum[i]==mx)
        {
            cout<<i+1<<endl;
            break;
        }
    }

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
 long n ,a,b,c,d,sum=0,x=0,mx=0;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a>>b>>c>>d;
sum=a+b+c+d;
if(sum>=mx){
mx=sum;
x=i;
}
}
cout<<x<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int bsearch1()

int main()
{
    int n ,a,b,c,d,sum[1001],x=0,mx=0;
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>a>>b>>c>>d;
        if(i==0)
            mx=a+b+c+d;

        sum[i]=a+b+c+d;
    }
    sort(sum,sum+n+1);
    for(int i=0; i<n; i++)
    {
        if(sum[i]==mx)
        {
            cout<<i+1<<endl;
            break;
        }
    }

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
 long n ,a,b,c,d,sum=0,x=0,mx=0;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a>>b>>c>>d;
sum=a+b+c+d;
if(sum>=mx){
mx=sum;
x=i+1;
}
}
cout<<x<<endl;

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
 long n ,a,b,c,d,sum[1001],x=0,mx=0;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a>>b>>c>>d;
if(i==0)
mx=a+b+c+d;

sum[i]=a+b+c+d;
}
sort(sum,sum+n+1);

cout<<binary_search(sum,sum+n,mx)+1<<endl;

}


//#include "HEADERS.h"
//sleepy 's trend
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define     TCOUNT         printf("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
#define     FAST_IO 	ios_base::sync_with_stdio(false); cin.tie(0);
#define     READ        freopen("input.txt", "r", stdin);
#define     WRITE       freopen("output.txt", "w", stdout);

#define     str_to_int(stroka)      atoi(stroka.c_str())
#define     str_to_ll(stroka)       atoll(stroka.c_str())
#define     str_to_double(stroka)   atof(stroka.c_str()

#define 	REP(i,n)    for(__typeof(n) i=0; i<n; i++)// [0, n)
#define 	FOR(i,a,b)  for(__typeof(b) i=a; i<=b; i++)// [a, b]
#define 	ROF(i,a,b)  for(__typeof(b) i=b; i>=a; i--)// [b, a]
#define     SORT(x)     sort(x.begin(), x.end());
#define     CLEAR(t)    memset((t), 0, sizeof(t));
#define     ALL(x)      (x).begin() , (x).end()

#define		sz  	    size()
#define		pb 		    push_back
#define 	pf 		    push_front

#define 	VI 		    vector<int>
#define		VS 		    vector<string>
#define     VC          vector<char>
#define 	LL 		    long long
#define 	VL 		    vector<LL>
#define 	PII 	    pair<int, int>
#define 	PLL 	    pair<LL, LL>
#define 	VII 	    vector<PII>
#define 	VLL 	    vector<PLL>
#define 	VVI 	    vector< VI >
#define 	VVL 	    vector< VL >
#define		MII 	    map<int, int>
#define 	MLL 	    map<LL, LL>
#define 	MLS 	    map<LL, string>
#define 	MSL 	    map<string, LL>
#define 	MIS 	    map<int, string>
#define		MSI 	    map<string, int>
#define 	MSS 	    map<string, string>

const 	    LL          INF = (1<<30);
const	    double      eps = (1e-11);
const 	    LL          MOD = (LL)(1e9+7);
const 	    double      PI  = (acos(-1.0));
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

//easy functions
template< typename T >
inline T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template< typename T >
inline T lcm(T a, T b) { return (a / gcd(a, b)) * b; }
inline bool is_lower(char x) { return ('a' <= x && x <= 'z'); }
inline bool is_upper(char x) { return ('A' <= x && x <= 'Z'); }
inline bool is_digit(char x) { return ('0' <= x && x <= '9'); }
//______________________________________________________________

bool compa(PLL & a, PLL & b){
    if(a.second == b.second)return a.first < b.first;
    return a.second > b.second;
}

int main(){

    FAST_IO;

    //type your codes here..........
    LL n;cin>>n;

    VLL vau;
    REP(i,n){
        LL a, b, c, d;
        cin>>a>>b>>c>>d;
        vau.pb({i+1, a+b+c+d});///id sum
    }

    sort(ALL(vau), compa);

    int indx ;

    REP(i, n){
        if(vau[i].first == 1){
            indx = i+1;
            break;
        }
    }
    cout<<indx<<endl;

    return 0;
}


//#include "HEADERS.h"
//sleepy 's trend
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define     TCOUNT         printf("Total Time: %.3f\n", (double)(clock() - z) / CLOCKS_PER_SEC);
#define     FAST_IO 	ios_base::sync_with_stdio(false); cin.tie(0);
#define     READ        freopen("input.txt", "r", stdin);
#define     WRITE       freopen("output.txt", "w", stdout);

#define     str_to_int(stroka)      atoi(stroka.c_str())
#define     str_to_ll(stroka)       atoll(stroka.c_str())
#define     str_to_double(stroka)   atof(stroka.c_str()

#define 	REP(i,n)    for(__typeof(n) i=0; i<n; i++)// [0, n)
#define 	FOR(i,a,b)  for(__typeof(b) i=a; i<=b; i++)// [a, b]
#define 	ROF(i,a,b)  for(__typeof(b) i=b; i>=a; i--)// [b, a]
#define     SORT(x)     sort(x.begin(), x.end());
#define     CLEAR(t)    memset((t), 0, sizeof(t));
#define     ALL(x)      (x).begin() , (x).end()

#define		sz  	    size()
#define		pb 		    push_back
#define 	pf 		    push_front

#define 	VI 		    vector<int>
#define		VS 		    vector<string>
#define     VC          vector<char>
#define 	LL 		    long long
#define 	VL 		    vector<LL>
#define 	PII 	    pair<int, int>
#define 	PLL 	    pair<LL, LL>
#define 	VII 	    vector<PII>
#define 	VLL 	    vector<PLL>
#define 	VVI 	    vector< VI >
#define 	VVL 	    vector< VL >
#define		MII 	    map<int, int>
#define 	MLL 	    map<LL, LL>
#define 	MLS 	    map<LL, string>
#define 	MSL 	    map<string, LL>
#define 	MIS 	    map<int, string>
#define		MSI 	    map<string, int>
#define 	MSS 	    map<string, string>

const 	    LL          INF = (1<<30);
const	    double      eps = (1e-11);
const 	    LL          MOD = (LL)(1e9+7);
const 	    double      PI  = (acos(-1.0));
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

//easy functions
template< typename T >
inline T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template< typename T >
inline T lcm(T a, T b) { return (a / gcd(a, b)) * b; }
inline bool is_lower(char x) { return ('a' <= x && x <= 'z'); }
inline bool is_upper(char x) { return ('A' <= x && x <= 'Z'); }
inline bool is_digit(char x) { return ('0' <= x && x <= '9'); }
//______________________________________________________________

bool compa(PLL & a, PLL & b){
    if(a.second == b.second)return a.first < b.first;
    return a.second > b.second;
}

int main(){

    FAST_IO;

    //type your codes here..........
    LL n;cin>>n;

    VLL vau(n);
    REP(i,n){
        LL a, b, c, d;
        cin>>a>>b>>c>>d;
        vau.pb({i+1, a+b+c+d});///id sum
    }

    sort(ALL(vau), compa);

    int indx ;

    REP(i, n){
        if(vau[i].first == 1){
            indx = i+1;
            break;
        }
    }
    cout<<indx<<endl;

    return 0;
}