#include <bits/stdc++.h>
using namespace std;
long long n, endAt = 1, vis[1001];
vector<long long> v[1001];
void dfs(long long x) {
  if (vis[x]) {
    endAt = x;
    return;
  }
  vis[x] = 1;
  for (auto i : v[x]) dfs(i);
}
int main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    long long temp;
    cin >> temp;
    v[i].push_back(temp);
  }
  for (long long i = 1; i <= n; i++) {
    memset(vis, 0, sizeof vis);
    dfs(i);
    cout << endAt << ' ';
    endAt = i + 1;
  }
}
