#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> sitting;
int g[30][30];
bool used[30];
long long d[16][1 << 16];
bool try_put(int c, int i, int m) {
  for (int j = 0; j < N; j++) {
    if (sitting[j] != -1) {
      if (g[j][i] && sitting[j] > c) {
        return false;
      }
      if (g[i][j] && c > sitting[j]) {
        return false;
      }
    } else if (m & (1 << j)) {
      if (g[i][j]) {
        return false;
      }
    }
  }
  return true;
}
long long do_calc(int next, int m) {
  if (m + 1 == (1 << N)) return 1;
  if (d[next][m] == -1) {
    long long& res = d[next][m];
    res = 0;
    int c = next;
    while (used[c]) c++;
    for (int i = 0; i < N; i++)
      if ((m & (1 << i)) == 0 && try_put(c, i, m))
        res += do_calc(c + 1, m | (1 << i));
  }
  return d[next][m];
}
long long calc_cnt(int first) {
  memset(d, -1, sizeof(d));
  return do_calc(0, (1 << first) - 1);
}
int main() {
  long long K;
  cin >> N >> K;
  sitting.resize(N, -1);
  int M;
  cin >> M;
  memset(g, 0, sizeof(g));
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a][b] = true;
  }
  for (int k = 0; k < N; k++)
    for (int i = 0; i < N; i++)
      for (int j = 0; j < N; j++) g[i][j] |= g[i][k] && g[k][j];
  K -= 2001;
  memset(used, 0, sizeof(used));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++)
      if (!used[j]) {
        sitting[i] = j;
        used[j] = true;
        long long c = calc_cnt(i + 1);
        if (c > K) {
          break;
        } else {
          K -= c;
          used[j] = false;
          sitting[i] = -1;
        }
      }
    if (sitting[i] == -1) {
      cout << "The times have changed" << endl;
      return 0;
    }
  }
  for (int i = 0; i < N; i++) cout << sitting[i] + 1 << " ";
  cout << endl;
}
