#include using namespace std; int main() { int n = 5; vector a(n), b(n), c(n); for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) cin >> b[i]; for (int i = 0; i < n; i++) c[i] = i + 1; auto f = [](vector x, vector y) { int size = x.size(); vector result(size); for (int i = 0; i < size; i++) { result[i] = y[x[i] - 1]; } return result; }; c = f(c, a); c = f(c, b); for (int i = 0; i < n; i++) { cout << c[i]; if (i < n - 1) { cout << ' '; } } cout << '\n'; }