#include <bits/stdc++.h>
using namespace std;
const int N = 18;
const int B = (1 << 17) + 10;
int ans[N], n, m;
long long f[B], ohh[N];
long long k, g[N];
bool used[N];
void init() {
  ohh[0] = 1;
  for (int i = 1; i <= n; i++) ohh[i] = (ohh[i - 1] << 1ll);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k >> m;
  k -= 2001;
  init();
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    g[b - 1] |= ohh[a - 1];
  }
  memset(ans, -1, sizeof(ans));
  for (int i = 0; i < n; i++) {
    for (ans[i] = 0;; ans[i]++) {
      if (used[ans[i]]) continue;
      if (ans[i] >= n) {
        puts("The times have changed");
        return 0;
      }
      memset(f, 0, sizeof(f));
      f[0] = 1;
      for (int s = 0; s < ohh[n]; s++) {
        if (!f[s]) continue;
        int cnt = __builtin_popcount(s);
        for (int j = 0; j < n; j++) {
          if (s & ohh[j]) continue;
          if (((s & g[j]) == g[j]) && (ans[j] == cnt || ans[j] == -1)) {
            f[s | ohh[j]] += f[s];
          }
        }
      }
      if (f[ohh[n] - 1] <= k)
        k -= f[ohh[n] - 1];
      else {
        used[ans[i]] = 1;
        break;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] + 1 << " ";
  }
  cout << endl;
  return 0;
}
