#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1E-7;
const int inf = int(1e9) + 7;
const int maxN = 16;
long long dp[(1 << (maxN))];
int g[(1 << (maxN))];
int ans[maxN];
bool mark[maxN];
long long y;
int n, m;
int main() {
  cin >> n >> y >> m;
  for (int(i) = 0; (i) < (m); ++(i)) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[b] |= (1 << (a));
  }
  y -= 2000;
  int tot = (1 << (n)) - 1;
  memset(ans, -1, sizeof(ans));
  for (int(i) = 0; (i) < (n); ++(i)) {
    while (1 > 0) {
      ans[i]++;
      if (ans[i] >= n) return puts("The times have changed");
      if (mark[ans[i]]) continue;
      memset((dp), 0, sizeof((dp)));
      dp[0] = 1;
      for (int(st) = 0; (st) < ((1 << (n))); ++(st))
        if (dp[st]) {
          int th = __builtin_popcount(st);
          for (int(k) = 0; (k) < (n); ++(k))
            if ((st & (1 << (k))) == 0)
              if ((g[k] & st) == g[k])
                if (ans[k] == -1 || ans[k] == th) {
                  dp[st | (1 << (k))] += dp[st];
                }
        }
      if (dp[tot] < y) {
        y -= dp[tot];
      } else {
        mark[ans[i]] = true;
        break;
      }
    }
  }
  for (int(i) = 0; (i) < (n - 1); ++(i)) cout << ans[i] + 1 << " ";
  cout << ans[n - 1] + 1 << endl;
  return 0;
}
