#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<list>
#include<stack>
#include<map>
#include<set>
#include<string>
#include <sstream>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;


int main(){
  long ii,jj,kk;
  vector<int> a;
  int n,q,b,e,t;

  cin >> n;

  a.resize(n);
  for(ii=0;ii<n;ii++){
    cin >> a[ii];
  }
  
  cin >> q;
  int pos1,pos2,tmp;
  for(ii=0;ii<q;ii++){

    cin >> b >> e >> t;

    for(jj=0;jj<e - b;jj++){
      pos1 = b + jj;
      pos2 = t + jj;
      tmp = a[pos1];
      a[pos1] = a[pos2];
      a[pos2] = tmp;
    }
    
  }

    vector<int>::iterator it = a.begin();

  while(it != a.end()){
    cout << *it;
    it++;
    if(it != a.end()){
      cout << " ";
    }
    else{
      cout << endl;
    }
  }
  
  return 0;
}

