#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define int long long
using namespace std;
signed main() {
	int n, q, a[1234];
	cin >> n; for (int i = 0; i < n; i++)cin >> a[i];
	cin >> q;
	for (int wq = 0; wq < q; wq++) {
		int b, e, t; cin >> b >> e >> t;
		for (int i = 0; i < e - b; i++)swap(a[b + i], a[t + i]);
	}
	for (int i = 0; i < n; i++) {
		if (i)cout << ' ';
		cout << a[i];
	}cout << endl;
}
