#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int P[N], I[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &P[i]);
  }
  int id = 1;
  for (int i = 1; i <= n; i++) {
    int cur = i;
    while (I[cur] != id) {
      I[cur] = id;
      cur = P[cur];
    }
    id++;
    printf("%d ", cur);
  }
  return 0;
}
