#include <bits/stdc++.h>
using namespace std;
const int N = 16;
int n;
int mm[N], where[N];
long long dp[1 << N];
long long solve(int mask) {
  int id = __builtin_popcount(mask);
  if (id == n) return 1;
  if (dp[mask] != -1) return dp[mask];
  long long answer = 0;
  if (where[id] != -1) {
    if ((mask & (1 << where[id])) == 0 &&
        (mask & mm[where[id]]) == mm[where[id]])
      answer += solve(mask | (1 << where[id]));
  } else {
    for (int i = 0; i < n; ++i)
      if ((mask & (1 << i)) == 0 && (mask & mm[i]) == mm[i])
        answer += solve(mask | (1 << i));
  }
  return dp[mask] = answer;
}
int ans[N];
int main() {
  long long pos;
  int m;
  cin >> n >> pos >> m;
  int a, b;
  for (int i = 0; i < m; ++i) {
    scanf("%d %d", &a, &b);
    a--;
    b--;
    mm[b] |= 1 << a;
  }
  for (int i = 0; i < n; ++i) where[i] = -1;
  pos -= 2000;
  memset(dp, -1, sizeof dp);
  if (solve(0) < pos)
    puts("The times have changed");
  else {
    int sentados = 0;
    for (int i = 0; i < n; ++i) {
      for (int w = 0; w < n; ++w) {
        if (where[w] != -1) continue;
        where[w] = i;
        memset(dp, -1, sizeof dp);
        if (pos > solve(0))
          pos -= solve(0);
        else
          break;
        where[w] = -1;
      }
    }
    for (int i = 0; i < n; ++i) ans[where[i]] = i + 1;
    for (int i = 0; i < n; ++i) cout << ans[i] << " ";
    cout << endl;
  }
  return 0;
}
