#include <bits/stdc++.h>
using namespace std;
int G[20];
long long ans[20], dp[(1 << 16) + 5], vis[20];
int main(int argc, char** argv) {
  int n;
  long long y;
  int m;
  cin >> n >> y >> m;
  y -= 2001;
  for (int i = 1; i <= m; i++) {
    int a, b;
    scanf("%d", &a);
    scanf("%d", &b);
    G[b - 1] |= (1 << (a - 1));
  }
  int f = 0;
  int S = (1 << n) - 1;
  memset(ans, -1, sizeof(ans));
  for (int i = 0; i <= n - 1; i++) {
    if (f) break;
    while (1) {
      ans[i]++;
      if (vis[ans[i]]) continue;
      memset(dp, 0, sizeof(dp));
      dp[0] = 1;
      if (ans[i] >= n) {
        f = 1;
        break;
      }
      for (int j = 0; j <= S; j++) {
        int cnt = 0;
        for (int k = 0; k <= n - 1; k++) {
          if ((1 << k) & j) cnt++;
        }
        for (int k = 0; k <= n - 1; k++) {
          if (j & (1 << k)) continue;
          if ((ans[k] == cnt || ans[k] == -1) && ((G[k] & j) == G[k])) {
            dp[j | (1 << k)] += dp[j];
          }
        }
      }
      if (dp[S] > y) {
        vis[ans[i]]++;
        break;
      } else {
        y -= dp[S];
      }
    }
  }
  if (!f)
    for (int i = 0; i <= n - 1; i++) {
      cout << ans[i] + 1 << " ";
    }
  else
    puts("The times have changed");
  return 0;
}
