#include <algorithm>
#include <iostream>
#include <iterator>
#include <limits>
#include <sstream>
#include <vector>

using namespace std;
int main() {
  cin.ignore(numeric_limits<streamsize>::max(), '\n');
  string s;
  getline(cin, s);
  istringstream is{s};
  istream_iterator<int> ii{is}, eol;
  vector<int> v{ii, eol};
  cin.ignore(numeric_limits<streamsize>::max(), '\n');

  int b, e, t;
  while (cin >> b >> e >> t) {
    swap_ranges(v.begin() + b, v.begin() + e, v.begin() + t);
  }
  cout << v[0];
  for (auto it = ++v.begin(); it != v.end(); ++it)
    cout << " " << *it;
  cout << endl;
}
