#include <bits/stdc++.h>
using namespace std;
int n, m;
int k;
bool debug = false;
long long dp[1 << 16];
int g[20], ans[20];
bool mk[20];
int main() {
  long long y;
  cin >> n >> y >> m;
  for (int a, b, i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    a--;
    b--;
    g[b] |= 1 << a;
  }
  y -= 2001;
  memset(ans, -1, sizeof ans);
  for (int i = 0; i < n; i++) {
    for (ans[i] = 0;; ans[i]++)
      if (!mk[ans[i]]) {
        if (ans[i] >= n) {
          puts("The times have changed");
          return 0;
        }
        memset(dp, 0, sizeof dp);
        dp[0] = 1;
        for (int mask = 0; mask < (1 << n); mask++)
          if (dp[mask]) {
            int w = __builtin_popcount(mask);
            for (int k = 0; k < n; k++)
              if (~(mask >> k) & 1) {
                if (ans[k] == -1 || ans[k] == w) {
                  if ((g[k] & mask) == g[k]) {
                    dp[mask | (1 << k)] += dp[mask];
                  }
                }
              }
          }
        if (dp[(1 << n) - 1] <= y) {
          y -= dp[(1 << n) - 1];
        } else {
          mk[ans[i]] = 1;
          break;
        }
      }
  }
  for (int i = 0; i < n; i++) printf("%d ", ans[i] + 1);
  return 0;
}
