#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m, nn;
int xiao[20], a[20], b[20], f[20], ge[(1 << 16)];
long long K, h[(1 << 16)];
inline long long suan() {
  int i, j;
  memset(h, 0, sizeof(h));
  h[0] = 1;
  for (i = 0; i <= nn - 1; i++)
    if (h[i]) {
      int A = ge[i] + 1;
      for (j = 1; j <= n; j++)
        if (!(i >> j - 1 & 1) && (!f[A] || f[A] == j)) {
          if ((xiao[j] | i) > i) continue;
          int B = i | 1 << j - 1;
          h[B] += h[i];
        }
    }
  return h[nn];
}
void dfs(int x) {
  if (x > n) {
    int i;
    for (i = 1; i <= n; i++) printf("%d ", b[i]);
    printf("\n");
    exit(0);
  }
  if (suan() < K) {
    K -= suan();
    return;
  }
  int i;
  for (i = 1; i <= n; i++)
    if (!f[i]) {
      f[i] = x;
      b[x] = i;
      dfs(x + 1);
      f[i] = 0;
    }
}
int main() {
  scanf("%d%I64d%d", &n, &K, &m);
  for (i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    xiao[y] |= 1 << x - 1;
  }
  K -= 2000;
  nn = (1 << n) - 1;
  for (i = 0; i <= nn; i++)
    for (j = 0; j <= n - 1; j++) ge[i] += i >> j & 1;
  dfs(1);
  printf("The times have changed\n");
  return 0;
}
