#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a,q,b,e,t;
    std::deque<int> deq;
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> a;
        deq.emplace_back(a);
    }
    cin >> q;
    for (int j=0;j<q;j++) {
        cin >> b >> e >> t;
        for (int k=0;k<(e-b);k++) {
            swap(deq[b+k],deq[t+k]);
        }
    }
    for (int l=0;l<deq.size();l++) {
        if ( l==deq.size()-1 ) {
            cout << deq[l] << endl;
        } else {
            cout << deq[l] << " ";
        }
    }
}

