#include #define rep(i,n) for (int i = 0; i < (int)(n); i ++) #define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i) using namespace std; using ll = long long; using PL = pair; using P = pair; constexpr int INF = 1000000000; constexpr long long HINF = 1000000000000000; constexpr long long MOD = 1000000007;// = 998244353; constexpr double EPS = 1e-4; constexpr double PI = 3.14159265358979; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N,K,X; cin >> N >> K >> X; vector

change(K); rep(i,K) { if (i == X - 1) { char x,y; cin >> x >> y; } else { cin >> change[i].first >> change[i].second; } } vector S(N),T(N); rep(i,N) S[i] = i + 1; rep(i,N) cin >> T[i]; rep(i,X - 1) swap(S[change[i].first - 1],S[change[i].second - 1]); for (int i = K - 1;i >= X;--i) swap(T[change[i].first - 1],T[change[i].second - 1]); rep(i,N) { if (S[i] != T[i]) cout << i + 1 << ' '; } cout << '\n'; return 0; }