#include <bits/stdc++.h>
using namespace std;
int n, m;
int color[20], profesor[20], vAns[20];
bool flag;
long long int kva;
vector<int> adj[20];
long long int dp[(1 << 16) + 10];
void dfs(int node) {
  color[node] = 1;
  for (int i = 0; i < adj[node].size(); i++) {
    int next = adj[node][i];
    if (color[next] == 0)
      dfs(next);
    else if (color[next] == 1)
      flag = true;
  }
  color[node] = -1;
}
void printMask(int mask) {
  for (int i = 0; i < n; i++) {
    if (mask & (1 << i))
      cout << "1";
    else
      cout << "0";
  }
  cout << endl;
}
long long int f(int mask) {
  if (mask == ((1 << n) - 1)) return 1LL;
  long long int &ans = dp[mask];
  if (ans != -1LL) return ans;
  ans = 0LL;
  int idProfesor = __builtin_popcount(mask);
  int idSilla = profesor[idProfesor];
  if (idSilla == -1) {
    for (int i = 0; i < n; i++) {
      if ((mask & (1 << i)) == 0) {
        bool sw = true;
        for (int k = 0; k < adj[i].size(); k++)
          if ((mask & (1 << adj[i][k])) == 0) {
            sw = false;
            break;
          }
        if (sw) ans += f(mask | (1 << i));
      }
    }
  } else {
    bool sw = (mask & (1 << idSilla)) == 0;
    for (int i = 0; sw && i < adj[idSilla].size(); i++) {
      if ((mask & (1 << adj[idSilla][i])) == 0) {
        sw = false;
        break;
      }
    }
    if (sw) ans += f(mask | (1 << idSilla));
  }
  return ans;
}
void printPathKva() {
  for (int silla = 0; silla < n; silla++) {
    for (int profe = 0; profe < n; profe++) {
      if (profesor[profe] != -1) continue;
      profesor[profe] = silla;
      memset(dp, -1, sizeof(dp));
      if (f(0) >= kva) {
        vAns[silla] = profe;
        break;
      } else {
        kva -= f(0);
        profesor[profe] = -1;
      }
    }
  }
  for (int i = 0; i < n; i++) cout << vAns[i] + 1 << " ";
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  int a, b;
  cin >> n >> kva >> m;
  kva -= 2000LL;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    a--;
    b--;
    adj[b].push_back(a);
  }
  flag = false;
  for (int i = 0; i < n; i++)
    if (color[i] == 0) dfs(i);
  memset(dp, -1, sizeof(dp));
  memset(profesor, -1, sizeof(profesor));
  if (flag || f(0) < kva)
    cout << "The times have changed" << endl;
  else
    printPathKva();
  return 0;
}
