#include <bits/stdc++.h>
using namespace std;
int u[17], r[17];
bool gr[17][17];
long long d[65700];
int v[65700];
int n, m, a, b, iter, cur;
long long second;
long long arr(int mask, int num) {
  if (mask == 0) return 1;
  if (v[mask] == iter) return d[mask];
  v[mask] = iter;
  while (u[num]) num--;
  long long res = 0;
  for (int i = 0; i < (n); i++)
    if (mask & (1 << i)) {
      bool ok = 1;
      for (int j = 0; j < (n); j++) {
        if (mask & (1 << j)) {
          if (gr[j][i]) {
            ok = 0;
            break;
          }
        }
      }
      for (int j = 0; j < (cur + 1); j++) {
        if (gr[j][i] && r[j] < num) {
          ok = 0;
          break;
        }
        if (gr[i][j] && r[j] > num) {
          ok = 0;
          break;
        }
      }
      if (ok) res += arr(mask ^ (1 << i), num - 1);
    }
  return d[mask] = res;
}
int main() {
  cin >> n >> second >> m;
  second -= 2001;
  for (int i = 0; i < (m); i++) {
    cin >> a >> b;
    a--;
    b--;
    gr[b][a] = 1;
  }
  for (cur = 0; cur < n; cur++) {
    for (int q = 0; q < n; q++)
      if (!u[q]) {
        bool ok = 1;
        for (int i = 0; i < (cur); i++) {
          if (gr[cur][i] && q < r[i]) ok = 0;
          if (gr[i][cur] && q > r[i]) ok = 0;
        }
        if (ok == 0) continue;
        iter = 1 + cur * n + q;
        r[cur] = q;
        u[q] = 1;
        long long add = arr((1 << n) - (1 << cur + 1), n - 1);
        if (second < add) {
          break;
        } else {
          u[q] = 0;
          second -= add;
        }
      }
    if (u[r[cur]] == 0) {
      printf("The times have changed\n");
      return 0;
    }
  }
  if (second > 0) {
    printf("The times have changed\n");
    return 0;
  }
  for (int i = 0; i < (n); i++) printf("%d ", r[i] + 1);
  printf("\n");
}
