#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
bool mp[N][N];
int v[N];
int n;
void init() {
  for (int i = 0; i <= n; i++) v[i] = 0;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++) mp[i][j] = 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  int a;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    mp[i][a] = true;
  }
  for (int i = 1; i <= n; i++) {
    memset(v, 0, sizeof(v));
    int j, k;
    for (j = 1; j <= n; j++) {
      if (mp[i][j]) {
        v[i]++;
        v[j]++;
        k = j;
        break;
      }
    }
    if (v[j] == 2) {
      if (i == n)
        cout << j << endl;
      else
        cout << j << " ";
      continue;
    }
    while (1) {
      int p;
      for (p = 1; p <= n; p++) {
        if (mp[k][p]) {
          v[p]++;
          break;
        }
      }
      if (v[p] == 2) {
        if (i == n)
          cout << p << endl;
        else
          cout << p << " ";
        break;
      }
      k = p;
    }
  }
  return 0;
}
