#include <bits/stdc++.h>
using namespace std;
long long f[1 << 16];
int ans[16], p[16];
bool u[17];
int main(void) {
  int n, m;
  long long t;
  scanf("%d %I64d %d", &n, &t, &m);
  for (int i = 0; i < m; ++i) {
    int j, k;
    scanf("%d %d", &j, &k);
    p[k - 1] |= 1 << (j - 1);
  }
  t -= 2000;
  for (int i = 0; i < n; ++i) {
    for (ans[i] = 1; ans[i] <= n; ++ans[i]) {
      if (u[ans[i]]) continue;
      int c = 0;
      for (int k = ans[i]; k > 0; k /= 2) c += k % 2;
      memset(f, 0, sizeof(f));
      f[0] = 1;
      for (int k = 0; k < (1 << n) - 1; ++k) {
        int c = 0;
        for (int temp = k; temp > 0; temp /= 2) c += temp % 2;
        ++c;
        for (int j = 0; j < n; ++j)
          if (((k & (1 << j)) == 0) && ((k & p[j]) == p[j]) &&
              ((ans[j] == 0) || (ans[j] == c)))
            f[k | (1 << j)] += f[k];
      }
      if (t <= f[(1 << n) - 1]) {
        u[ans[i]] = true;
        break;
      }
      t -= f[(1 << n) - 1];
    }
    if (ans[i] > n) {
      printf("The times have changed\n");
      return 0;
    }
  }
  for (int i = 0; i < n - 1; ++i) printf("%d ", ans[i]);
  printf("%d\n", ans[n - 1]);
  return 0;
}
