#include <bits/stdc++.h>
using namespace std;
int n, m, q[16], ans[16];
long long y, f[1 << 16];
int main() {
  cin >> n >> y >> m;
  y -= 2000;
  for (int i = 1, a, b; i <= m; i++) cin >> a >> b, q[b - 1] |= 1 << a - 1;
  for (int i = 0; i < n; i++) ans[i] = -1;
  for (int i = 0; i < n; i++) {
    for (ans[i] = 0; ans[i] < n; ans[i]++) {
      memset(f, 0, sizeof(f));
      f[0] = 1;
      for (int j = 0; j < (1 << n); j++) {
        int t = __builtin_popcount(j);
        for (int k = 0; k < n; k++)
          if (!(j & (1 << k)) && (ans[k] == t || ans[k] == -1) &&
              (j & q[k]) == q[k])
            f[j | (1 << k)] += f[j];
      }
      if (f[(1 << n) - 1] >= y) break;
      y -= f[(1 << n) - 1];
    }
    if (ans[i] >= n) return (cout << "The times have changed\n"), 0;
  }
  for (int i = 0; i < n; i++) cout << ans[i] + 1 << ' ';
  cout << endl;
  return 0;
}
