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 CPP):

Solution:
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000000000")
using namespace std;
const long long int INF = 2e18;
int used[26], with[26][26];
bool dfs(int id, int n) {
  used[id] = 1;
  for (int i = 0; i < n; i++) {
    if (with[id][i]) {
      if (used[i] == 1) return false;
      if (!used[i]) dfs(i, n);
    }
  }
  used[id] = 2;
  return true;
}
long long int dp[1 << 16], up[1 << 16];
int can[18][1 << 16];
long long int cnt[1 << 16];
int c1[18], c2[18];
int ch[18], re_ch[18];
void got_it(int n, int allready) {
  memset(dp, 0, sizeof dp);
  int tz = 0;
  int tete[19];
  for (int i = n - 1; i >= 0; i--) {
    if (ch[i] == -1) tete[tz++] = i;
  }
  for (int i = 0; i < n; i++) {
    if (ch[i] == -1) {
      int m1 = 0, m2 = (1 << allready) - 1;
      c1[i] = 0;
      c2[i] = 0;
      for (int j = 0; j < allready; j++) {
        if (re_ch[j] > i) {
          for (int k = allready; k < n; k++) {
            if (with[j][k]) m1 = (m1 ^ (1 << k));
          }
        } else
          m2 = (m2 ^ (1 << j));
      }
      c1[i] = m1;
      c2[i] = m2;
    }
  }
  dp[(1 << n) - 1] = 1;
  for (int j = (1LL << n) - 1; j >= 0; j--) {
    int kol = 0;
    if ((j & ((1 << allready) - 1)) != ((1 << allready) - 1)) continue;
    for (int i = allready; i < n; i++) {
      if (j & (1 << i)) kol++;
    }
    if ((!kol)) continue;
    kol--;
    kol = tete[tz - 1 - kol];
    int m1 = c1[kol];
    int m2 = (j ^ c2[kol]);
    for (int i = allready; i < n; i++) {
      if (m1 & (1 << i)) continue;
      if ((m2 & (1 << i)) && !can[i][m2 ^ (1 << i)]) {
        dp[j ^ (1 << i)] = min(INF, dp[j ^ (1 << i)] + dp[j]);
      }
    }
  }
  memset(up, 0, sizeof up);
  memset(cnt, 0, sizeof cnt);
  cnt[0] = dp[(1 << (allready + 1)) - 1];
  for (int j = allready; j < n; j++) {
    up[((1 << (allready)) - 1) | (1 << j)] = 1;
  }
  for (int j = 0; j < (1 << n); j++) {
    if ((j & ((1 << allready) - 1)) != ((1 << allready) - 1)) continue;
    if (j & (1 << allready)) continue;
    int kol = 0;
    for (int i = allready; i < n; i++) {
      if (j & (1 << i)) kol++;
    }
    if (!kol) continue;
    int nm = tete[tz - 1 - kol];
    int m1 = c1[nm];
    int m2 = (j ^ c2[nm]);
    cnt[kol] = min(INF, cnt[kol] + (up[j] * dp[j | (1 << allready)]));
    for (int i = allready; i < n; i++) {
      if (m1 & (1 << i)) continue;
      if (!(m2 & (1 << i)) && !can[i][m2]) {
        up[j | (1 << i)] = min(INF, up[j | (1 << i)] + up[j]);
      }
    }
  }
}
int main() {
  long long int n, y, m;
  cin >> n >> y >> m;
  memset(used, 0, sizeof used);
  memset(with, 0, sizeof with);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    with[a][b]++;
  }
  memset(can, 0, sizeof can);
  memset(cnt, 0, sizeof cnt);
  for (int i = 0; i < (1 << n); i++) {
    for (int j = 0; j < n; j++) {
      if (i & (1 << j)) {
        cnt[i]++;
        continue;
      }
      for (int k = 0; k < n; k++) {
        if ((i & (1 << k)) && with[j][k]) {
          can[j][i]++;
        }
      }
    }
  }
  memset(used, 0, sizeof used);
  for (int i = 0; i < n; i++) {
    if (!used[i] && !dfs(i, n)) {
      cout << "The times have changed";
      return 0;
    }
  }
  memset(ch, -1, sizeof ch);
  memset(re_ch, -1, sizeof re_ch);
  y -= 2000;
  got_it(n, 0);
  if (dp[0] < y) {
    cout << "The times have changed";
    return 0;
  }
  for (int i = 0; i < n; i++) {
    got_it(n, i);
    int nx = 0;
    for (int j = 0; j < n; j++) {
      if (ch[j] != -1) continue;
      ch[j] = i;
      re_ch[i] = j;
      long long int val = cnt[nx++];
      if (val >= y) {
        break;
      }
      y -= val;
      ch[j] = -1;
      re_ch[i] = -1;
    }
  }
  for (int i = 0; i < n; i++) cout << re_ch[i] + 1 << " ";
}