#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int inf = 1e9;
const long long Inf = 1e10;
const int P = 1e9 + 7;
inline int IN() {
  char ch = getchar();
  int x = 0, f = 0;
  for (; ch < 48 || ch > 57; ch = getchar()) f = (ch == '-');
  for (; ch >= 48 && ch <= 57; ch = getchar()) x = x * 10 + ch - 48;
  return f ? (-x) : x;
}
inline int Pow(int x, int y, int p) {
  int a = 1;
  for (; y; y >>= 1, x = (long long)x * x % p)
    if (y & 1) a = (long long)a * x % p;
  return a;
}
int n, m, upl, cnt[N], xian[N];
int used[N], wei[N];
long long f[N], year;
long long work() {
  for (int i = (int)(0); i < (int)(upl); i++) f[i] = 0;
  f[0] = 1;
  for (int i = (int)(0); i < (int)(1 << n); i++)
    for (int j = (int)(0); j < (int)(n); j++)
      if (!((i >> j) & 1)) {
        int ni = i | (1 << j);
        int fan = (~i) & (upl - 1);
        if (xian[j] & fan) continue;
        if (used[cnt[i]] && j != wei[cnt[i]]) continue;
        f[ni] += f[i];
      }
  return f[upl - 1];
}
int main() {
  scanf("%d%I64d%d", &n, &year, &m);
  year -= 2000, upl = 1 << n;
  for (int i = (int)(0); i < (int)(upl); i++) cnt[i] = cnt[i >> 1] + (i & 1);
  while (m--) {
    int x = IN() - 1, y = IN() - 1;
    xian[y] |= 1 << x;
  }
  if (year > work()) return puts("The times have changed"), 0;
  for (int i = (int)(0); i < (int)(n); i++) {
    int tmp = 0;
    for (int j = (int)(0); j < (int)(n); j++)
      if (!used[j]) {
        used[j] = 1;
        wei[j] = i;
        long long k = work();
        if (year > k) {
          used[j] = wei[j] = 0;
          year -= k;
        } else {
          tmp = j;
          break;
        }
      }
    printf("%d ", ++tmp);
  }
  return 0;
}
