#include #include #include #include #include int main() { using namespace std; int n, k, x; cin >> n >> k >> x; vector a(n); iota(a.begin(), a.end(), 1); for (int _ = 0; _ < x - 1; _++) { int i, j; cin >> i >> j; swap(a[i - 1], a[j - 1]); } char ax, ay; cin >> ax >> ay; vector> shuffle(k - x); for (auto &[i, j] : shuffle) { cin >> i >> j; } vector c(n); for (auto &e : c) { cin >> e; } for (int t = k - x - 1; t >= 0 ; t--) { auto [i, j] = shuffle[t]; swap(c[i - 1], c[j - 1]); } for (int i = 0; i < n; i++) { if (a[i] != c[i]) { cout << i + 1 << " "; } } cout << endl; }