#include <bits/stdc++.h>
using namespace std;
long long year, dp[70000];
int n, m, need[17], ans[17], bits_cnt[70000];
bool used[17];
long long calc(int state) {
  if (state == (1 << n) - 1) {
    dp[state] = 1;
    return 1;
  }
  if (dp[state] > -1) {
    return dp[state];
  }
  if (bits_cnt[state] == -1) {
    int usd = 0;
    for (int i = 0; i < n; ++i) {
      if (state & (1 << i)) {
        ++usd;
      }
    }
    bits_cnt[state] = usd;
  }
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    if (!(state & (1 << i))) {
      if ((state & need[i]) != need[i]) {
        continue;
      }
      if (ans[i] == 0 || ans[i] == bits_cnt[state] + 1) {
        sum += calc(state | (1 << i));
      }
    }
  }
  dp[state] = sum;
  return sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  memset(bits_cnt, -1, sizeof(bits_cnt));
  memset(dp, -1, sizeof(dp));
  cin >> n >> year >> m;
  year -= 2000;
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    --x;
    --y;
    need[y] = need[y] | (1 << x);
  }
  if (calc(0) < year) {
    cout << "The times have changed";
  } else {
    for (int j = 0; j < n; ++j) {
      for (int i = 1; i < n + 1; ++i) {
        if (!used[i]) {
          ans[j] = i;
          memset(dp, -1, sizeof(dp));
          auto k = calc(0);
          if (k < year) {
            year -= k;
          } else {
            used[i] = true;
            break;
          }
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      cout << ans[i] << ' ';
    }
  }
  return 0;
}
