#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const long long OO = 1LL << 61;
const long long MOD = 10007;
const int maxn = 100000 + 5;
long long dp[(1 << (16)) + 6];
int ans[20], g[20], mark[20], full;
int main() {
  int n, m, a, b, f;
  long long y;
  while (scanf("%d %I64d %d", &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("%d %d", &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("%d%c", ans[i] + 1, i + 1 == n ? '\n' : ' ');
  }
  return 0;
}
