#include <bits/stdc++.h>
using namespace std;
const int MAXN = 20;
const int MAXX = 65536;
int n, m;
long long year;
vector<int> graph[MAXN], rev_graph[MAXN];
vector<int> sol;
long long dp[MAXX];
long long countPermutations(int mask, int pos) {
  dp[0] = 1;
  for (int i = 1; i < 1 << (n - pos); ++i) {
    dp[i] = 0;
  }
  for (int i = 0; i < 1 << (n - pos); ++i) {
    int value = n - 1;
    while (value >= 0 && (mask & (1 << value))) --value;
    for (int j = 0; j < n - pos; ++j)
      if (i & (1 << j)) {
        do {
          --value;
        } while (value >= 0 && (mask & (1 << value)));
      }
    for (int j = 0; j < n - pos; ++j)
      if ((i & (1 << j)) == 0) {
        int ok = 1;
        for (size_t k = 0; k < graph[j + pos].size() && ok; ++k)
          if ((graph[j + pos][k] >= pos &&
               (i & (1 << (graph[j + pos][k] - pos))) == 0) ||
              (graph[j + pos][k] < pos && sol[graph[j + pos][k]] < value)) {
            ok = 0;
          }
        for (size_t k = 0; k < rev_graph[j + pos].size() && ok; ++k)
          if (rev_graph[j + pos][k] < pos && sol[rev_graph[j + pos][k]] > value)
            ok = 0;
        if (ok) dp[i ^ (1 << j)] += dp[i];
      }
  }
  return dp[(1 << (n - pos)) - 1];
}
void findPermutation(int mask, int pos) {
  if (pos < n) {
    for (int i = 0; i < n; ++i)
      if ((mask & (1 << i)) == 0) {
        int ok = 1;
        for (size_t j = 0; j < graph[pos].size() && ok; ++j)
          if (graph[pos][j] < pos && sol[graph[pos][j]] < i) ok = 0;
        for (size_t j = 0; j < rev_graph[pos].size() && ok; ++j)
          if (rev_graph[pos][j] < pos && sol[rev_graph[pos][j]] > i) ok = 0;
        if (!ok) {
          continue;
        }
        mask ^= 1 << i;
        sol.push_back(i);
        long long cnt = countPermutations(mask, pos + 1);
        if (cnt >= year) {
          findPermutation(mask, pos + 1);
          break;
        }
        year -= cnt;
        mask ^= 1 << i;
        sol.pop_back();
      }
  }
}
int main() {
  cin >> n >> year >> m;
  year -= 2000;
  for (int i = 1; i <= m; ++i) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    graph[x].push_back(y);
    rev_graph[y].push_back(x);
  }
  findPermutation(0, 0);
  if ((int)sol.size() != n) {
    cout << "The times have changed\n";
    return 0;
  }
  for (int i = 0; i < n - 1; ++i) cout << sol[i] + 1 << " ";
  cout << sol[n - 1] + 1 << '\n';
  return 0;
}
