#include<iostream>
using namespace std;

void swap( int& x, int& y )
{
    int temp = x;
    x = y;
    y = temp;
}

void swapRange( int* a, int b, int e, int t )
{
    for( int k = 0; k < e - b; k++ )
    {
        int x = b + k;
        int y = t + k;
        swap( a[x], a[y] );
    }
}

int main()
{
    int n, q;
    int b, e, t;

    cin >> n;

    int a[n];

    for( int i = 0; i < n; i++ )
        cin >> a[i];
    
    cin >> q;

    for( int i = 0; i < q; i++ )
    {
        cin >> b >> e >> t;
        swapRange( a, b, e, t );
    }

    for( int i = 0; i < n; i++ )
    {
        if( i != n - 1 )
            cout << a[i] << " ";
        else
            cout << a[i] << endl;
    }
    return 0;
}
