#include<algorithm>
#include<cstdio>
#include<vector>
#include<iostream>

using namespace std;

int main(){
    int len_array,num_query;
    int b,e,t;
    scanf("%d",&len_array);
    vector<int> int_array(len_array,0);
    
    for(int i = 0;i < len_array;i++){
        cin >> int_array[i];
    }
    
    scanf("%d",&num_query);
    for(int i = 0;i < num_query;i++){
        scanf("%d %d %d",&b,&e,&t);
        for(int k = 0; k < e-b;k ++ ){
            swap(int_array[b+k],int_array[t+k]);
        }
    }
    
    for(int i = 0;i < len_array;i++){
        cout << int_array[i];
        if(i!=len_array-1) cout << " ";
        else cout << "\n";
    }
    
    return 0;
}
