#include <bits/stdc++.h>
using namespace std;
int n, tt[1005];
vector<int> a[1005];
void dfs(int u) {
  if (tt[u] == 1) {
    printf("%d ", u);
    return;
  }
  tt[u] = 1;
  for (int i = 0; i < a[u].size(); ++i) dfs(a[u][i]);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    a[i].push_back(x);
  }
  for (int i = 1; i <= n; ++i) {
    dfs(i);
    for (int j = 1; j <= n; ++j) tt[j] = 0;
  }
  return 0;
}
