Problem: In the year 2500 the annual graduation ceremony in the German University in Cairo (GUC) has run smoothly for almost 500 years so far.

The most important part of the ceremony is related to the arrangement of the professors in the ceremonial hall.

Traditionally GUC has n professors. Each professor has his seniority level. All seniorities are different. Let's enumerate the professors from 1 to n, with 1 being the most senior professor and n being the most junior professor.

The ceremonial hall has n seats, one seat for each professor. Some places in this hall are meant for more senior professors than the others. More specifically, m pairs of seats are in "senior-junior" relation, and the tradition requires that for all m pairs of seats (ai, bi) the professor seated in "senior" position ai should be more senior than the professor seated in "junior" position bi.

GUC is very strict about its traditions, which have been carefully observed starting from year 2001. The tradition requires that: 

  * The seating of the professors changes every year. 
  * Year 2001 ceremony was using lexicographically first arrangement of professors in the ceremonial hall. 
  * Each consecutive year lexicographically next arrangement of the professors is used. 



The arrangement of the professors is the list of n integers, where the first integer is the seniority of the professor seated in position number one, the second integer is the seniority of the professor seated in position number two, etc.

Given n, the number of professors, y, the current year and m pairs of restrictions, output the arrangement of the professors for this year.

Input

The first line contains three integers n, y and m (1 ≤ n ≤ 16, 2001 ≤ y ≤ 1018, 0 ≤ m ≤ 100) — the number of professors, the year for which the arrangement should be computed, and the number of pairs of seats for which the seniority relation should be kept, respectively.

The next m lines contain one pair of integers each, "ai bi", indicating that professor on the ai-th seat is more senior than professor on the bi-th seat (1 ≤ ai, bi ≤ n, ai ≠ bi). Some pair may be listed more than once.

Please, do not use the %lld specificator to read or write 64-bit integers in С++. It is preferred to use the cin stream (you may also use the %I64d specificator).

Output

Print the order in which the professors should be seated in the requested year.

If by this year the GUC would have ran out of arrangements, or the given "senior-junior" relation are contradictory, print "The times have changed" (without quotes).

Examples

Input

3 2001 2
1 2
2 3


Output

1 2 3


Input

7 2020 6
1 2
1 3
2 4
2 5
3 6
3 7


Output

1 2 3 7 4 6 5


Input

10 3630801 0


Output

The times have changed


Input

3 2001 3
1 2
2 3
3 1


Output

The times have changed

Note

In the first example the lexicographically first order of seating is 1 2 3.

In the third example the GUC will run out of arrangements after the year 3630800.

In the fourth example there are no valid arrangements for the seating.

The lexicographical comparison of arrangements is performed by the < operator in modern programming languages. The arrangement a is lexicographically less that the arrangement b, if there exists such i (1 ≤ i ≤ n), that ai < bi, and for any j (1 ≤ j < i) aj = bj.

Solution (in JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class TaskC {
        private long[] dp;
        private int n;
        private long y;
        private int[][] rules;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            input(in);
            int[] solution = solve();
            if (solution == null) {
                out.print("The times have changed");
            } else {
                out.print(solution);
            }
        }

        private int[] solve() {
            int[] p = new int[n];
            Arrays.fill(p, -1);
            outer:
            for (int i = 0; i < n; i++) {
                for (int k = 0; k <= n; k++) {
                    if (k == n) {
                        return null;
                    }
                    if (contains(p, i - 1, k)) {
                        continue;
                    }
                    p[i] = k;
                    int[] nums = gen(p, i);
                    long count = getCount(nums, p, i);
                    if (y >= count) {
                        y -= count;
                    } else {
                        continue outer;
                    }
                }
            }
            for (int i = 0; i < n; i++) {
                p[i]++;
            }
            return p;
        }

        private boolean contains(int[] a, int lastIdx, int val) {
            for (int i = 0; i <= lastIdx; i++) {
                if (a[i] == val) {
                    return true;
                }
            }
            return false;
        }

        private int[] gen(int[] p, int lastUsedIdx) {
            int[] a = new int[p.length - lastUsedIdx - 1];
            for (int i = 0, at = 0; i < p.length; i++) {
                if (!contains(p, lastUsedIdx, i)) {
                    a[at++] = i;
                }
            }
            return a;
        }

        private long getCount(int m, int at, int pLastIdx, int[] p, int[] nums) {
            long result = dp[m];
            if (result != -1) {
                return result;
            }
            result = 0;

            if (m == (1 << nums.length) - 1) {
                return dp[m] = 1;
            }

            int e = nums[at];
            for (int i = 0; i < nums.length; i++) {
                if (!get(m, i)) {
                    boolean ok = true;
                    for (int[] rule : rules) {
                        int a = rule[0];
                        int b = rule[1];
                        int ainm = a - (pLastIdx + 1);
                        int binm = b - (pLastIdx + 1);
                        if (ainm == i) {
                            if (b <= pLastIdx) {    //b in p
                                if (p[b] < e) {
                                    ok = false;
                                }
                            } else if (get(m, binm)) {
                                ok = false;
                            }
                        } else if (binm == i) {
                            if (a <= pLastIdx) {
                                if (p[a] > e) {
                                    ok = false;
                                }
                            } else if (!get(m, ainm)) {
                                ok = false;
                            }
                        }
                        if (!ok) {
                            break;
                        }
                    }
                    if (ok) {
                        result += getCount(set(m, i), at + 1, pLastIdx, p, nums);
                    }
                }
            }

            return dp[m] = result;
        }

        private long getCount(int[] nums, int[] p, int pLastIdx) {
            dp = new long[1 << nums.length];
            Arrays.fill(dp, -1);
            return getCount(0, 0, pLastIdx, p, nums);
        }

        private boolean get(int m, int b) {
            return ((m >> b) & 1) == 1;
        }

        private int set(int m, int b) {
            return m | (1 << b);
        }

        private void input(InputReader in) {
            n = in.readInt();
            y = in.readLong() - 2001;
            rules = IOUtils.readIntTable(in, in.readInt(), 2);
            for (int[] rule : rules) {
                MiscUtils.decreaseByOne(rule);
            }
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void print(int[] array) {
            for (int i = 0; i < array.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(array[i]);
            }
        }

        public void close() {
            writer.close();
        }

    }

    static class MiscUtils {
        public static void decreaseByOne(int[]... arrays) {
            for (int[] array : arrays) {
                for (int i = 0; i < array.length; i++) {
                    array[i]--;
                }
            }
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.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 long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long 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 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 interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class IOUtils {
        public static int[] readIntArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readInt();
            }
            return array;
        }

        public static int[][] readIntTable(InputReader in, int rowCount, int columnCount) {
            int[][] table = new int[rowCount][];
            for (int i = 0; i < rowCount; i++) {
                table[i] = readIntArray(in, columnCount);
            }
            return table;
        }

    }
}