#include <bits/stdc++.h>
using namespace std;
const long long LINF = ~(((long long)0x1) << 63) / 2;
const int INF = 0X3F3F3F3F;
const double eps = 1e-7;
int mat[110][110];
int my[110];
long long dp[1 << 16];
int cnt[1 << 16], ok[20];
int ans[20], n;
long long solve(int u) {
  memset(dp, 0, sizeof(dp));
  dp[0] = 1;
  for (int i = 1; i < (1 << n); i++) {
    for (int j = 0; j < n; j++)
      if (((1 << j) & i) && (i & my[j]) == my[j] &&
          (j > u || ans[j] == n - cnt[i]))
        dp[i] += dp[i ^ (1 << j)];
  }
  return dp[(1 << n) - 1];
}
int main() {
  int i, j, k, m, a, b;
  long long y;
  cin >> n >> y >> m;
  y -= 2000;
  for (i = 0; i < (1 << n); i++)
    for (j = i; j; j -= j & (-j)) cnt[i]++;
  for (i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    a--;
    b--;
    mat[a][b] = 1;
  }
  for (k = 0; k < n; k++)
    for (i = 0; i < n; i++)
      for (j = 0; j < n; j++) mat[i][j] |= (mat[i][k] & mat[k][j]);
  bool flag = false;
  for (i = 0; i < n; i++) {
    if (mat[i][i]) flag = true;
    my[i] |= (1 << i);
    for (j = 0; j < n; j++)
      if (mat[i][j]) my[i] |= (1 << j);
  }
  if (flag || solve(-1) < y) {
    puts("The times have changed");
    return 0;
  }
  long long now;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (ok[j]) continue;
      ans[i] = j;
      now = solve(i);
      if (now >= y) {
        ok[j] = 1;
        break;
      }
      y -= now;
    }
  }
  flag = false;
  for (i = 0; i < n; i++)
    if (!ok[i]) flag = true;
  if (flag)
    puts("The times have changed");
  else {
    printf("%d", ans[0] + 1);
    for (i = 1; i < n; i++) printf(" %d", ans[i] + 1);
    puts("");
  }
  return 0;
}
