#include <bits/stdc++.h>
using namespace std;
inline long long R() {
  long long an = 0, kk = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') kk = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') an = an * 10 + c - '0', c = getchar();
  return an * kk;
}
long long dp[1 << 16], ans[20], g[20], mark[20], full;
int main() {
  long long n, m, a, b, f, y;
  while (scanf("%lld%I64d%lld", &n, &y, &m) != EOF) {
    memset(g, 0, sizeof g);
    memset(ans, -1, sizeof ans);
    memset(mark, 0, sizeof mark);
    for (int i = 0; i < m; i++) scanf("%lld%lld", &a, &b), g[--b] |= 1 << (--a);
    f = 1;
    y -= 2001;
    full = (1 << n) - 1;
    for (int i = 0; i < n && f; i++)
      for (ans[i] = 0;; ans[i]++)
        if (!mark[ans[i]]) {
          if (ans[i] >= n) {
            f = 0;
            puts("The times have changed");
            break;
          }
          memset(dp, 0, sizeof dp);
          dp[0] = 1;
          for (int s = 0; s <= full; s++)
            if (dp[s]) {
              int cnt = __builtin_popcount(s);
              for (int k = 0; k < n; k++)
                if (!(s & (1 << k)))
                  if ((ans[k] == -1 || ans[k] == cnt) && ((s & g[k]) == g[k]))
                    dp[s | 1 << k] += dp[s];
            }
          if (y >= dp[full])
            y -= dp[full];
          else {
            mark[ans[i]] = 1;
            break;
          }
        }
    if (!f) continue;
    for (int i = 0; i < n; i++)
      printf("%lld%c", ans[i] + 1, i + 1 == n ? '\n' : ' ');
  }
  return 0;
}
