#include <bits/stdc++.h>
using namespace std;
int vis[10001];
int main() {
  int n, ar[10001];
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
  }
  for (int i = 1; i <= n; i++) {
    int j = i;
    while (vis[j] != i) vis[j] = i, j = ar[j];
    cout << j << " ";
  }
}
