#include <bits/stdc++.h>
using namespace std;
int n, viz[1 << 10], v[1 << 10];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> v[i];
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) viz[j] = 0;
    int x = i;
    while (!viz[x]) {
      viz[x] = 1;
      x = v[x];
    }
    cout << x << ' ';
  }
  return 0;
}
