#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
	int	N;
	cin >> N;
	vector<int> vec;
	rep(i, N)
	{
		int	a;
		cin >> a;
		vec.push_back(a);
	}
	int M;
	cin >> M;
	rep(i, M)
	{
		int	b, e, t;
		cin >> b >> e >> t;
		for (int k = 0; k < e - b; k++)
			swap(vec.at(b + k), vec.at(t + k));
	}
	rep(i, N)
	{
		if (i)
			cout << ' ';
		cout << vec.at(i);
	}
	cout << endl;
}

