#include <bits/stdc++.h>
using namespace std;
int n;
int gene[22];
bool cmp[22];
int pos[22];
vector<vector<int> > AdjList;
bool no_usar[22];
long long memo[17][(1 << 16) + 10];
long long sol(int id, int mask) {
  if (id == n) return 1;
  if (memo[id][mask] != -1) return memo[id][mask];
  int grados[22];
  for (int i = 0; i < n; i++) grados[i] = gene[i];
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (mask & (1 << i)) {
      for (int j = 0; j < AdjList[i].size(); j++) grados[AdjList[i][j]]--;
    }
  }
  if (cmp[id]) {
    if (grados[pos[id]] == 0) {
      ans += sol(id + 1, mask | (1 << pos[id]));
    }
  } else {
    for (int i = 0; i < n; i++) {
      if (grados[i] == 0) {
        if (mask & (1 << i))
          ;
        else if (!no_usar[i])
          ans += sol(id + 1, mask | (1 << i));
      }
    }
  }
  return memo[id][mask] = ans;
}
int main() {
  int m, x, y;
  long long anio;
  cin >> n >> anio >> m;
  AdjList.assign(n, vector<int>());
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &x, &y);
    x--, y--;
    AdjList[x].push_back(y);
    gene[y]++;
  }
  anio -= 2000;
  long long acum = 0;
  for (int i = 0; i < n; i++) {
    no_usar[i] = true;
    bool tmp = false;
    for (int j = 0; j < n; j++)
      if (!cmp[j]) {
        pos[j] = i;
        cmp[j] = true;
        memset(memo, -1, sizeof memo);
        long long gg = sol(0, 0);
        if (acum + gg >= anio) {
          tmp = true;
          break;
        } else {
          acum += gg;
        }
        cmp[j] = false;
      }
    if (!tmp) {
      cout << "The times have changed" << endl;
      return 0;
    }
  }
  int ans[22];
  for (int i = 0; i < n; i++) {
    ans[pos[i]] = i + 1;
  }
  if (acum + 1 == anio) {
    for (int i = 0; i < n; i++) cout << ans[i] << " ";
    cout << endl;
  } else {
    cout << "The times have changed" << endl;
  }
}
