#include <bits/stdc++.h>
using namespace std;
const int maxn = 16;
const int maxm = 100 + 5;
int n, m;
long long y;
int sta[maxn + 2], ans[maxn + 2];
long long dp[(1 << (maxn))];
bool vis[maxn + 2];
int nb[(1 << (maxn))];
void setin() {
  memset(nb, 0, sizeof(nb));
  for (int s = 1; s < (1 << (maxn)); s++) {
    int rs = s;
    while (rs) nb[s] += (rs & 1), rs >>= 1;
  }
}
int main() {
  setin();
  scanf("%d%I64d%d", &n, &y, &m);
  y -= 2000;
  while (m--) {
    int a, b;
    scanf("%d%d", &a, &b);
    sta[--b] |= (1 << (--a));
  }
  int N = (1 << (n));
  memset(ans, -1, sizeof(ans));
  memset(vis, false, sizeof(vis));
  for (int i = 0; i < n; ++i) {
    for (ans[i] = 0;; ++ans[i])
      if (!vis[ans[i]]) {
        if (ans[i] >= n) return puts("The times have changed");
        memset(dp, 0, sizeof(dp));
        dp[0] = 1;
        for (int s = 0; s < N; ++s)
          if (dp[s]) {
            for (int k = 0; k < n; ++k)
              if (!(s & (1 << (k))))
                if ((ans[k] == -1 || ans[k] == nb[s]) && (sta[k] & s) == sta[k])
                  dp[s | (1 << (k))] += dp[s];
          }
        if (dp[N - 1] < y)
          y -= dp[N - 1];
        else {
          vis[ans[i]] = true;
          break;
        }
      }
  }
  for (int i = 0; i < n; i++)
    printf("%d%c", ans[i] + 1, i + 1 == n ? '\n' : ' ');
  return 0;
}
