#include <bits/stdc++.h>
using namespace std;
int n, m;
long long f[1 << 16], y;
int g[16], ans[16];
bool mark[16 + 1];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> y >> m;
  y -= 2001;
  int a, b;
  while (m--) {
    cin >> a >> b;
    g[--b] |= (1 << (--a));
  }
  int nMax = (1 << n) - 1;
  memset(ans, -1, sizeof(ans));
  for (int i = 0; i < n; ++i) {
    for (ans[i] = 0;; ++ans[i]) {
      if (!mark[ans[i]]) {
        if (ans[i] >= n) {
          cout << "The times have changed";
          return 0;
        }
        memset(f, 0, sizeof(f));
        f[0] = 1;
        for (int z = 0; z <= nMax; ++z) {
          if (f[z]) {
            b = __builtin_popcount(z);
            for (int k = 0; k < n; ++k) {
              if (!((z >> k) & 1)) {
                if ((ans[k] == -1 || ans[k] == b) && ((z & g[k]) == g[k])) {
                  f[z | (1 << (k))] += f[z];
                }
              }
            }
          }
        }
        if (y >= f[nMax]) {
          y -= f[nMax];
        } else {
          mark[ans[i]] = true;
          break;
        }
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << ans[i] + 1 << ' ';
  }
  return 0;
}
