Problem: Very soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the olympiad. The qualifying contest to form teams was held and it was attended by n Berland students. There were at least two schoolboys participating from each of the m regions of Berland. The result of each of the participants of the qualifying competition is an integer score from 0 to 800 inclusive.

The team of each region is formed from two such members of the qualifying competition of the region, that none of them can be replaced by a schoolboy of the same region, not included in the team and who received a greater number of points. There may be a situation where a team of some region can not be formed uniquely, that is, there is more than one school team that meets the properties described above. In this case, the region needs to undertake an additional contest. The two teams in the region are considered to be different if there is at least one schoolboy who is included in one team and is not included in the other team. It is guaranteed that for each region at least two its representatives participated in the qualifying contest.

Your task is, given the results of the qualifying competition, to identify the team from each region, or to announce that in this region its formation requires additional contests.

Input

The first line of the input contains two integers n and m (2 ≤ n ≤ 100 000, 1 ≤ m ≤ 10 000, n ≥ 2m) — the number of participants of the qualifying contest and the number of regions in Berland.

Next n lines contain the description of the participants of the qualifying contest in the following format: Surname (a string of length from 1 to 10 characters and consisting of large and small English letters), region number (integer from 1 to m) and the number of points scored by the participant (integer from 0 to 800, inclusive).

It is guaranteed that all surnames of all the participants are distinct and at least two people participated from each of the m regions. The surnames that only differ in letter cases, should be considered distinct.

Output

Print m lines. On the i-th line print the team of the i-th region — the surnames of the two team members in an arbitrary order, or a single character "?" (without the quotes) if you need to spend further qualifying contests in the region.

Examples

Input

5 2
Ivanov 1 763
Andreev 2 800
Petrov 1 595
Sidorov 1 790
Semenov 2 503


Output

Sidorov Ivanov
Andreev Semenov


Input

5 2
Ivanov 1 800
Andreev 2 763
Petrov 1 800
Sidorov 1 800
Semenov 2 503


Output

?
Andreev Semenov

Note

In the first sample region teams are uniquely determined.

In the second sample the team from region 2 is uniquely determined and the team from region 1 can have three teams: "Petrov"-"Sidorov", "Ivanov"-"Sidorov", "Ivanov" -"Petrov", so it is impossible to determine a team uniquely.

Solution (in JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Comparator;
import java.util.Collections;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Artem Gilmudinov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n, m;
            n = in.readInt();
            m = in.readInt();
            Pupil[] pupils = new Pupil[n];
            for (int i = 0; i < n; i++) {
                pupils[i] = new Pupil(in.next(), in.readInt() - 1, in.readInt());
            }
            ArrayList<ArrayList<Pupil>> pupilsByRegions = new ArrayList<>();
            for (int i = 0; i < m; i++) {
                pupilsByRegions.add(new ArrayList<Pupil>());
            }
            for (Pupil pupil : pupils) {
                pupilsByRegions.get(pupil.region).add(pupil);
            }
            Comparator<Pupil> cmp = new Comparator<Pupil>() {

                public int compare(Pupil o1, Pupil o2) {
                    return o2.score - o1.score;
                }
            };
            for (ArrayList<Pupil> list : pupilsByRegions) {
                Collections.sort(list, cmp);
            }
            for (int i = 0; i < m; i++) {
                ArrayList<Pupil> list = pupilsByRegions.get(i);
                int iter = 0;
                PairInt[] borders = new PairInt[2];
                for (int j = 0, z = 0; j < list.size() && iter < 2; iter++, j = z) {
                    for (; z < list.size(); z++) {
                        if (list.get(j).score != list.get(z).score) {
                            break;
                        }
                    }
                    int cnt = z - j;
                    borders[iter] = new PairInt(j, z - 1);
                }
                int cnt = borders[0].y - borders[0].x + 1;
                if (borders[1] == null) {
                    if (cnt == 2) {
                        out.println(list.get(0).surname + " " + list.get(1).surname);
                    } else {
                        out.println("?");
                    }
                } else {
                    if (cnt == 2) {
                        out.println(list.get(0).surname + " " + list.get(1).surname);
                    } else if (cnt > 2) {
                        out.println("?");
                    } else {
                        int cnt2 = borders[1].y - borders[1].x + 1;
                        if (cnt2 > 1) {
                            out.println("?");
                        } else {
                            out.println(list.get(0).surname + " " + list.get(1).surname);
                        }
                    }
                }
            }
        }

        class Pupil {
            String surname;
            int region;
            int score;

            public Pupil(String surname, int region, int score) {
                this.surname = surname;
                this.region = region;
                this.score = score;
            }

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c))
                    res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class PairInt {
        public int x;
        public int y;

        public PairInt(int x, int y) {
            this.x = x;
            this.y = y;
        }


        public boolean equals(Object obj) {
            PairInt pairInt = (PairInt) obj;
            return pairInt.x == x && pairInt.y == y;
        }

        public String toString() {
            return x + " " + y;
        }

        public PairInt clone() {
            return new PairInt(x, y);
        }

    }
}