#include <bits/stdc++.h>
using namespace std;
const int N = 20, M = (1 << 16) + 5;
int n, m, two[N], cnt[M], x, y, a[N], b[N], p[N];
long long f[M][N], k;
void dp(int x) {
  for (int i = 0; i <= two[n] - 1; i++)
    for (int j = 0; j <= n; j++) f[i][j] = 0;
  f[0][0] = 1;
  for (int i = 0; i <= two[n] - 1; i++) {
    for (int j = 0; j <= n; j++) {
      int y = cnt[i] + 1;
      if (b[y]) {
        if ((a[b[y]] & i) != a[b[y]]) continue;
        if ((two[b[y] - 1] & i) == two[b[y] - 1]) continue;
        f[i | two[b[y] - 1]][j | ((b[y] == x) * y)] += f[i][j];
        continue;
      } else {
        for (int k = 1; k <= n; k++)
          if (!(two[k - 1] & i)) {
            if ((a[k] & i) != a[k]) continue;
            f[i | two[k - 1]][j | ((k == x) * y)] += f[i][j];
          }
      }
    }
  }
}
int main() {
  scanf("%d%lld%d", &n, &k, &m);
  k -= 2000;
  two[0] = 1;
  for (int i = 1; i <= n; i++) two[i] = two[i - 1] << 1;
  for (int i = 0; i <= two[n] - 1; i++)
    for (int j = 1; j <= n; j++)
      if (i & two[j - 1]) cnt[i]++;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    a[y] |= two[x - 1];
  }
  for (int i = 1; i <= n; i++) {
    dp(i);
    long long sum = 0;
    for (int j = 1; j <= n; j++) {
      if (!b[j] && sum + f[two[n] - 1][j] >= k) {
        b[j] = i;
        p[i] = j;
        k -= sum;
        break;
      }
      sum += f[two[n] - 1][j];
    }
    if (!p[i]) {
      printf("The times have changed\n");
      return 0;
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", p[i]);
  return 0;
}
