import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;
import java.text.DecimalFormat;
import java.lang.reflect.Array;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
public class B{
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	//static long MOD = (long)(1e9+7);
	static int MOD = 998244353;
	static long MOD2 = MOD*MOD;
	static FastReader sc = new FastReader();
	static int pInf = Integer.MAX_VALUE;
	static int nInf = Integer.MIN_VALUE;
	//static ArrayList<Long> A;
	public static void main(String[] args){
		int test = 1;
		test = sc.nextInt();
		while(test-->0)solve();
		out.flush();
		out.close();
	}
	//static ArrayList<Integer>[] A;
	public static void solve() {
		int n = sc.nextInt();
		TreeSet<Integer>[] a = new TreeSet[n];
		for(int i = 0; i < n; i++) {
			a[i] = new TreeSet<>();
		}
		for(int i = 0; i < 3; i++) {
			for(int j = 0; j < n; j++) {
				a[j].add(sc.nextInt());
			}
		}
		int[] ans = new int[n];
		for(int i = 0; i < n; i++) {
			if(a[i].size()==1) {
				ans[i] = a[i].first();
			}
		}
		for(int i = 0; i < n; i++) {
			if(ans[i]!=0) {
				continue;
			}
			if(i==0) {
				for(int g:a[i]) {
					if(g!=ans[i+1]) {
						ans[i] = g;
						break;
					}
				}
			}
			else if(i==n-1) {
				for(int g:a[i]) {
					if(g!=ans[i-1]) {
						ans[i] = g;
						break;
					}
				}
			}
			else {
				for(int g:a[i]) {
					if(g!=ans[i-1] && g!=ans[i+1]) {
						ans[i] = g;
						break;
					}
				}
			}
		}
		for(int g:ans) {
			out.print(g+" ");
		}
		out.println();
		return;
	}
	public static int maxRight(int x,int[] a) {
		int l = -1;      //a[l]<=x
		int r = a.length;//a[r]>x
		while(r-l>1) {
			int m = l+(r-l)/2;
			if(a[m]<=x) {
				l = m;
			}
			else {
				r = m;
			}
		}
		return l+1;
	}
	public static int minLeft(int x,int[] a) {
		int l = -1;      //a[l]<x
		int r = a.length;//a[r]>=x
		while(r-l>1) {
			int m = l+(r-l)/2;
			if(a[m]<x) {
				l = m;
			}
			else {
				r = m;
			}
		}
		return r+1;
	}
	public static int lowerBound(int key, int[] a) {
		int s = 0;
		int e = a.length-1;
		if(e==-1) {
			return 0;
		}
		int ans = -1;
		while(s<=e) {
			int m = s+(e-s)/2;
			if(a[m]>=key) {
				ans = m;
				e = m-1;
			}
			else {
				s = m+1;
			}
		}
		return ans==-1?s:ans;
	}
	public static int upperBound(int key, int[] a) {
		int s = 0;
		int e = a.length-1;
		if(e==-1) {
			return 0;
		}
		int ans = -1;
		while(s<=e) {
			int m = s+(e-s)/2;
			if(a[m]>key) {
				ans = m;
				e = m-1;
			}
			else {
				s = m+1;
			}
		}
		return ans==-1?s:ans;
	}
	public static long c2(long n) {
		if((n&1)==0) {
			return mul(n/2, n-1);
		}
		else {
			return mul(n, (n-1)/2);
		}
	}
	public static long mul(long a, long b){
	    return ((a%MOD)*(b%MOD))%MOD;
	}
	public static long add(long a, long b){
	    return ((a%MOD)+(b%MOD))%MOD;
	}
	public static long sub(long a, long b){
	    return ((a%MOD)-(b%MOD))%MOD;
	}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Integer.lowestOneBit(i)   Equals k where k is the position of the first one in the binary
//Integer.highestOneBit(i)  Equals k where k is the position of the last one in the binary
//Integer.bitCount(i)       returns the number of one-bits
//Collections.sort(A,(p1,p2)->(int)(p2.x-p1.x)) To sort ArrayList in descending order wrt values of x.
//            Arrays.parallelSort(a,new Comparator<TPair>() {
//      		public int compare(TPair a,TPair b) {
//        			if(a.y==b.y) return a.x-b.x;
//        			return b.y-a.y;
//        		}
//        	});
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//PrimeFactors
    public static ArrayList<Long> primeFactors(long n) {
        ArrayList<Long> arr = new ArrayList<>();
        if (n % 2 == 0)
            arr.add((long) 2);
        while (n % 2 == 0)
            n /= 2;
        for (long i = 3; i <= Math.sqrt(n); i += 2) {
            int flag = 0;
            while (n % i == 0) {
                n /= i;
                flag = 1;
            }
            if (flag == 1)
                arr.add(i);
        }
        if (n > 2)
            arr.add(n);
        return arr;
    }
//Pair Class
	static class Pair implements Comparable<Pair>{
		int x;
		int y;
		public Pair(int x, int y) {
			this.x = x;
			this.y = y;
		}
		@Override
		public int compareTo(Pair o) {
			if(this.x==o.x){
			    return (this.y-o.y);
			}
			return (this.x-o.x);
		}
	}
	static class TPair implements Comparable<TPair>{
		int l;
		int r;
		int index;
		public TPair(int l, int r, int index) {
			this.l = l;
			this.r = r;
			this.index = index;
		}
		@Override
		public int compareTo(TPair o) {
			if(this.l==o.l){
			    return -1*(this.r-o.r);
			}
			return -1*(this.l-o.l);
		}
	}
//nCr
	static long[] facts, factInvs;
	static long exp(long base, long e) {
		if (e==0) return 1;
		long half=exp(base, e/2);
		if (e%2==0) return mul(half, half);
		return mul(half, mul(half, base));
	}

	static long modInv(long x) {
		return exp(x, MOD-2);
	}

	static void precomp() {
		facts=new long[1_000_000];
		factInvs=new long[1_000_000];
		factInvs[0]=facts[0]=1;
		for (int i=1; i<facts.length; i++)
			facts[i]=mul(facts[i-1], i);
		factInvs[facts.length-1]=modInv(facts[facts.length-1]);
		for (int i=facts.length-2; i>=0; i--)
			factInvs[i]=mul(factInvs[i+1], i+1);
	}

	static long nCk(int n, int k) {
		return mul(facts[n], mul(factInvs[k], factInvs[n-k]));
	}
//Kadane's Algorithm
    static long maxSubArraySum(ArrayList<Long> a) {
    	if(a.size()==0) {
    		return 0;
    	}
    	long max_so_far = a.get(0);
    	long curr_max = a.get(0);
    	for (int i = 1; i < a.size(); i++) {
           curr_max = Math.max(a.get(i), curr_max+a.get(i));
           max_so_far = Math.max(max_so_far, curr_max);
    	}
    	return max_so_far;
    }
//Shuffle Sort
    static final Random random=new Random();
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
//Merge Sort
	static void merge(long arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long [n1];
        long R[] = new long [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    static void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }
//Brian Kernighans Algorithm
    static long countSetBits(long n){
        if(n==0) return 0;
        return 1+countSetBits(n&(n-1));
    }
//Factorial
    static long factorial(long n){
        if(n==1) return 1;
        if(n==2) return 2;
        if(n==3) return 6;
        return n*factorial(n-1);
    }
//Euclidean Algorithm
    static long gcd(long A,long B){
        if(B==0) return A;
        return gcd(B,A%B);
    }
//Modular Exponentiation
    static long fastExpo(long x,long n){
        if(n==0) return 1;
        if((n&1)==0) return fastExpo((x*x)%MOD,n/2)%MOD;
        return ((x%MOD)*fastExpo((x*x)%MOD,(n-1)/2))%MOD;
    }
//AKS Algorithm
    static boolean isPrime(long n){
        if(n<=1) return false;
        if(n<=3) return true;
        if(n%2==0 || n%3==0) return false;
        for(int i=5;i<=Math.sqrt(n);i+=6)
            if(n%i==0 || n%(i+2)==0) return false;
        return true;
    }
//Reverse an array
    static <T> void reverse(T arr[],int l,int r){
    	Collections.reverse(Arrays.asList(arr).subList(l, r));
    }
  //Print array
    static void print1d(long arr[]) {
    	out.println(Arrays.toString(arr));
    }
    static void print2d(int arr[][]) {
    	for(int a[]: arr) out.println(Arrays.toString(a));
    }
//Sieve of eratosthenes
    static int[] findPrimes(int n){
        boolean isPrime[]=new boolean[n+1];
        ArrayList<Integer> a=new ArrayList<>();
        int result[];
        Arrays.fill(isPrime,true);
        isPrime[0]=false;
        isPrime[1]=false;
        for(int i=2;i*i<=n;++i){
            if(isPrime[i]==true){
                for(int j=i*i;j<=n;j+=i) isPrime[j]=false;
            }
        }
        for(int i=0;i<=n;i++) if(isPrime[i]==true) a.add(i);
        result=new int[a.size()];
        for(int i=0;i<a.size();i++) result[i]=a.get(i);
        return result;

    }
//Indivisual factors of all nos till n
    static ArrayList<Integer>[] indiFactors(int n){
    	ArrayList<Integer>[] A = new ArrayList[n+1];
    	for(int i = 0; i <= n; i++) {
    		A[i] = new ArrayList<>();
    	}
    	int[] sieve = new int[n+1];
    	for(int i=2;i<=n;i++) {
       		if(sieve[i]==0) {
       			for(int j=i;j<=n;j+=i) if(sieve[j]==0) {
       				//sieve[j]=i;
       				A[j].add(i);
       			}
       		}
       	}
    	return A;
    }
//Segmented Sieve
    static boolean[] segmentedSieve(long l, long r){
    	boolean[] segSieve = new boolean[(int)(r-l+1)];
    	Arrays.fill(segSieve, true);
    	int[] prePrimes = findPrimes((int)Math.sqrt(r));
    	for(int p:prePrimes) {
    		long low = (l/p)*p;
    		if(low < l) {
    			low += p;
    		}
    		if(low == p) {
    			low += p;
    		}
    		for(long j = low; j<= r; j += p) {
    			segSieve[(int) (j-l)] = false;
    		}
    	}
    	if(l==1) {
    		segSieve[0] = false;
    	}
    	return segSieve;
    }
//Euler Totent function
    static long countCoprimes(long n){
        ArrayList<Long> prime_factors=new ArrayList<>();
        long x=n,flag=0;
        while(x%2==0){
            if(flag==0) prime_factors.add(2L);
            flag=1;
            x/=2;
        }
        for(long i=3;i*i<=x;i+=2){
            flag=0;
            while(x%i==0){
                if(flag==0) prime_factors.add(i);
                flag=1;
                x/=i;
            }
        }
        if(x>2) prime_factors.add(x);
        double ans=(double)n;
        for(Long p:prime_factors){
            ans*=(1.0-(Double)1.0/p);
        }
        return (long)ans;
    }
	static long modulo = (long)1e9+7;
	public static long modinv(long x){
	    return modpow(x, modulo-2);
	}
	public static long modpow(long a, long b){
	    if(b==0){
	        return 1;
	    }
	    long x = modpow(a, b/2);
	    x = (x*x)%modulo;
	    if(b%2==1){
	        return (x*a)%modulo;
	    }
	    return x;
	}
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
		//it reads the data about the specified point and divide the data about it ,it is quite fast
		//than using direct

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
}


import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;
import java.text.DecimalFormat;
import java.lang.reflect.Array;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
public class B{
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	//static long MOD = (long)(1e9+7);
	static int MOD = 998244353;
	static long MOD2 = MOD*MOD;
	static FastReader sc = new FastReader();
	static int pInf = Integer.MAX_VALUE;
	static int nInf = Integer.MIN_VALUE;
	//static ArrayList<Long> A;
	public static void main(String[] args){
		int test = 1;
		test = sc.nextInt();
		while(test-->0)solve();
		out.flush();
		out.close();
	}
	//static ArrayList<Integer>[] A;
	public static void solve() {
		int n = sc.nextInt();
		TreeSet<Integer>[] a = new TreeSet[n];
		for(int i = 0; i < n; i++) {
			a[i] = new TreeSet<>();
		}
		for(int i = 0; i < 3; i++) {
			for(int j = 0; j < n; j++) {
				a[j].add(sc.nextInt());
			}
		}
		int[] ans = new int[n];
		for(int i = 0; i < n; i++) {
			if(a[i].size()==1) {
				ans[i] = a[i].first();
			}
		}
		for(int i = 0; i < n; i++) {
			if(ans[i]!=0) {
				continue;
			}
			if(i==0) {
				for(int g:a[i]) {
					if(g!=ans[i+1] && g!=ans[n-1]) {
						ans[i] = g;
						break;
					}
				}
			}
			else if(i==n-1) {
				for(int g:a[i]) {
					if(g!=ans[i-1] && g!=ans[0]) {
						ans[i] = g;
						break;
					}
				}
			}
			else {
				for(int g:a[i]) {
					if(g!=ans[i-1] && g!=ans[i+1]) {
						ans[i] = g;
						break;
					}
				}
			}
		}
		for(int g:ans) {
			out.print(g+" ");
		}
		out.println();
		return;
	}
	public static int maxRight(int x,int[] a) {
		int l = -1;      //a[l]<=x
		int r = a.length;//a[r]>x
		while(r-l>1) {
			int m = l+(r-l)/2;
			if(a[m]<=x) {
				l = m;
			}
			else {
				r = m;
			}
		}
		return l+1;
	}
	public static int minLeft(int x,int[] a) {
		int l = -1;      //a[l]<x
		int r = a.length;//a[r]>=x
		while(r-l>1) {
			int m = l+(r-l)/2;
			if(a[m]<x) {
				l = m;
			}
			else {
				r = m;
			}
		}
		return r+1;
	}
	public static int lowerBound(int key, int[] a) {
		int s = 0;
		int e = a.length-1;
		if(e==-1) {
			return 0;
		}
		int ans = -1;
		while(s<=e) {
			int m = s+(e-s)/2;
			if(a[m]>=key) {
				ans = m;
				e = m-1;
			}
			else {
				s = m+1;
			}
		}
		return ans==-1?s:ans;
	}
	public static int upperBound(int key, int[] a) {
		int s = 0;
		int e = a.length-1;
		if(e==-1) {
			return 0;
		}
		int ans = -1;
		while(s<=e) {
			int m = s+(e-s)/2;
			if(a[m]>key) {
				ans = m;
				e = m-1;
			}
			else {
				s = m+1;
			}
		}
		return ans==-1?s:ans;
	}
	public static long c2(long n) {
		if((n&1)==0) {
			return mul(n/2, n-1);
		}
		else {
			return mul(n, (n-1)/2);
		}
	}
	public static long mul(long a, long b){
	    return ((a%MOD)*(b%MOD))%MOD;
	}
	public static long add(long a, long b){
	    return ((a%MOD)+(b%MOD))%MOD;
	}
	public static long sub(long a, long b){
	    return ((a%MOD)-(b%MOD))%MOD;
	}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Integer.lowestOneBit(i)   Equals k where k is the position of the first one in the binary
//Integer.highestOneBit(i)  Equals k where k is the position of the last one in the binary
//Integer.bitCount(i)       returns the number of one-bits
//Collections.sort(A,(p1,p2)->(int)(p2.x-p1.x)) To sort ArrayList in descending order wrt values of x.
//            Arrays.parallelSort(a,new Comparator<TPair>() {
//      		public int compare(TPair a,TPair b) {
//        			if(a.y==b.y) return a.x-b.x;
//        			return b.y-a.y;
//        		}
//        	});
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//PrimeFactors
    public static ArrayList<Long> primeFactors(long n) {
        ArrayList<Long> arr = new ArrayList<>();
        if (n % 2 == 0)
            arr.add((long) 2);
        while (n % 2 == 0)
            n /= 2;
        for (long i = 3; i <= Math.sqrt(n); i += 2) {
            int flag = 0;
            while (n % i == 0) {
                n /= i;
                flag = 1;
            }
            if (flag == 1)
                arr.add(i);
        }
        if (n > 2)
            arr.add(n);
        return arr;
    }
//Pair Class
	static class Pair implements Comparable<Pair>{
		int x;
		int y;
		public Pair(int x, int y) {
			this.x = x;
			this.y = y;
		}
		@Override
		public int compareTo(Pair o) {
			if(this.x==o.x){
			    return (this.y-o.y);
			}
			return (this.x-o.x);
		}
	}
	static class TPair implements Comparable<TPair>{
		int l;
		int r;
		int index;
		public TPair(int l, int r, int index) {
			this.l = l;
			this.r = r;
			this.index = index;
		}
		@Override
		public int compareTo(TPair o) {
			if(this.l==o.l){
			    return -1*(this.r-o.r);
			}
			return -1*(this.l-o.l);
		}
	}
//nCr
	static long[] facts, factInvs;
	static long exp(long base, long e) {
		if (e==0) return 1;
		long half=exp(base, e/2);
		if (e%2==0) return mul(half, half);
		return mul(half, mul(half, base));
	}

	static long modInv(long x) {
		return exp(x, MOD-2);
	}

	static void precomp() {
		facts=new long[1_000_000];
		factInvs=new long[1_000_000];
		factInvs[0]=facts[0]=1;
		for (int i=1; i<facts.length; i++)
			facts[i]=mul(facts[i-1], i);
		factInvs[facts.length-1]=modInv(facts[facts.length-1]);
		for (int i=facts.length-2; i>=0; i--)
			factInvs[i]=mul(factInvs[i+1], i+1);
	}

	static long nCk(int n, int k) {
		return mul(facts[n], mul(factInvs[k], factInvs[n-k]));
	}
//Kadane's Algorithm
    static long maxSubArraySum(ArrayList<Long> a) {
    	if(a.size()==0) {
    		return 0;
    	}
    	long max_so_far = a.get(0);
    	long curr_max = a.get(0);
    	for (int i = 1; i < a.size(); i++) {
           curr_max = Math.max(a.get(i), curr_max+a.get(i));
           max_so_far = Math.max(max_so_far, curr_max);
    	}
    	return max_so_far;
    }
//Shuffle Sort
    static final Random random=new Random();
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
//Merge Sort
	static void merge(long arr[], int l, int m, int r)
    {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long [n1];
        long R[] = new long [n2];

        /*Copy data to temp arrays*/
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2)
        {
            if (L[i] <= R[j])
            {
                arr[k] = L[i];
                i++;
            }
            else
            {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1)
        {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    static void sort(long arr[], int l, int r)
    {
        if (l < r)
        {
            // Find the middle point
            int m = (l+r)/2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr , m+1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }
//Brian Kernighans Algorithm
    static long countSetBits(long n){
        if(n==0) return 0;
        return 1+countSetBits(n&(n-1));
    }
//Factorial
    static long factorial(long n){
        if(n==1) return 1;
        if(n==2) return 2;
        if(n==3) return 6;
        return n*factorial(n-1);
    }
//Euclidean Algorithm
    static long gcd(long A,long B){
        if(B==0) return A;
        return gcd(B,A%B);
    }
//Modular Exponentiation
    static long fastExpo(long x,long n){
        if(n==0) return 1;
        if((n&1)==0) return fastExpo((x*x)%MOD,n/2)%MOD;
        return ((x%MOD)*fastExpo((x*x)%MOD,(n-1)/2))%MOD;
    }
//AKS Algorithm
    static boolean isPrime(long n){
        if(n<=1) return false;
        if(n<=3) return true;
        if(n%2==0 || n%3==0) return false;
        for(int i=5;i<=Math.sqrt(n);i+=6)
            if(n%i==0 || n%(i+2)==0) return false;
        return true;
    }
//Reverse an array
    static <T> void reverse(T arr[],int l,int r){
    	Collections.reverse(Arrays.asList(arr).subList(l, r));
    }
  //Print array
    static void print1d(long arr[]) {
    	out.println(Arrays.toString(arr));
    }
    static void print2d(int arr[][]) {
    	for(int a[]: arr) out.println(Arrays.toString(a));
    }
//Sieve of eratosthenes
    static int[] findPrimes(int n){
        boolean isPrime[]=new boolean[n+1];
        ArrayList<Integer> a=new ArrayList<>();
        int result[];
        Arrays.fill(isPrime,true);
        isPrime[0]=false;
        isPrime[1]=false;
        for(int i=2;i*i<=n;++i){
            if(isPrime[i]==true){
                for(int j=i*i;j<=n;j+=i) isPrime[j]=false;
            }
        }
        for(int i=0;i<=n;i++) if(isPrime[i]==true) a.add(i);
        result=new int[a.size()];
        for(int i=0;i<a.size();i++) result[i]=a.get(i);
        return result;

    }
//Indivisual factors of all nos till n
    static ArrayList<Integer>[] indiFactors(int n){
    	ArrayList<Integer>[] A = new ArrayList[n+1];
    	for(int i = 0; i <= n; i++) {
    		A[i] = new ArrayList<>();
    	}
    	int[] sieve = new int[n+1];
    	for(int i=2;i<=n;i++) {
       		if(sieve[i]==0) {
       			for(int j=i;j<=n;j+=i) if(sieve[j]==0) {
       				//sieve[j]=i;
       				A[j].add(i);
       			}
       		}
       	}
    	return A;
    }
//Segmented Sieve
    static boolean[] segmentedSieve(long l, long r){
    	boolean[] segSieve = new boolean[(int)(r-l+1)];
    	Arrays.fill(segSieve, true);
    	int[] prePrimes = findPrimes((int)Math.sqrt(r));
    	for(int p:prePrimes) {
    		long low = (l/p)*p;
    		if(low < l) {
    			low += p;
    		}
    		if(low == p) {
    			low += p;
    		}
    		for(long j = low; j<= r; j += p) {
    			segSieve[(int) (j-l)] = false;
    		}
    	}
    	if(l==1) {
    		segSieve[0] = false;
    	}
    	return segSieve;
    }
//Euler Totent function
    static long countCoprimes(long n){
        ArrayList<Long> prime_factors=new ArrayList<>();
        long x=n,flag=0;
        while(x%2==0){
            if(flag==0) prime_factors.add(2L);
            flag=1;
            x/=2;
        }
        for(long i=3;i*i<=x;i+=2){
            flag=0;
            while(x%i==0){
                if(flag==0) prime_factors.add(i);
                flag=1;
                x/=i;
            }
        }
        if(x>2) prime_factors.add(x);
        double ans=(double)n;
        for(Long p:prime_factors){
            ans*=(1.0-(Double)1.0/p);
        }
        return (long)ans;
    }
	static long modulo = (long)1e9+7;
	public static long modinv(long x){
	    return modpow(x, modulo-2);
	}
	public static long modpow(long a, long b){
	    if(b==0){
	        return 1;
	    }
	    long x = modpow(a, b/2);
	    x = (x*x)%modulo;
	    if(b%2==1){
	        return (x*a)%modulo;
	    }
	    return x;
	}
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
		//it reads the data about the specified point and divide the data about it ,it is quite fast
		//than using direct

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
    public void genArr(){

    }
	public static void main (String[] args) {
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t-->0){
		    int n=sc.nextInt();
		    int arr[][]=new int[3][n];
		    for(int i=0;i<3;i++){
		        for(int j=0;j<n;j++){
		            arr[i][j]=sc.nextInt();
		        }
		    }
		    int prev=-1;
		    for(int i=0;i<n;i++){
		        for(int j=0;j<3;j++){
		            if(prev!=arr[j][i]){
		             System.out.print(arr[j][i]+" ");
		             prev=arr[j][i];
		             j=n;
		            }
		        }
		    }
		    System.out.println();

		}
	}
}


import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
    public void genArr(){

    }
	public static void main (String[] args) {
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t-->0){
		    int n=sc.nextInt();
		    int arr[][]=new int[3][n];
		    for(int i=0;i<3;i++){
		        for(int j=0;j<n;j++){
		            arr[i][j]=sc.nextInt();
		        }
		    }
		    int prev=-1,one=arr[0][0];
		    for(int i=0;i<n;i++){
		        for(int j=0;j<3;j++){
		            if(prev!=arr[j][i]){
		                if(i==n-1){
		                    if(arr[j][i]!=one){System.out.print(arr[j][i]+" ");}else{continue;}
		                }else{
		             System.out.print(arr[j][i]+" ");
		             prev=arr[j][i];
		                }
		                j=n;
		            }
		        }
		    }
		    System.out.println();

		}
	}
}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int numdata = sc.nextInt();
        for (int i = 0; i < numdata; i++) {
            process(sc);
        }
    }

    public static void process(Scanner sc) {
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        for (int i = 0; i < n; i++) {
            b[i] = sc.nextInt();
        }

        for (int i = 0; i < n; i++) {
            c[i] = sc.nextInt();
        }

        int last = a[0];
        System.out.print(last);
        for (int i = 1; i < n-1; i++) {
            if (a[i] != last) {
                last = a[i];
            }
            else {
                last = b[i];
            }
            System.out.print(" " + last);
        }
        if (a[n-1] != last && a[n-1] != a[0]) {
            last = a[n-1];
        }
        else if (b[n-1] != last && b[n-1] != a[0]) {
            last = b[n-1];
        }
        else {
            last = c[n-1];
        }
        System.out.println(" " + last);
    }
}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int numdata = sc.nextInt();
        for (int i = 0; i < numdata; i++) {
            process(sc);
        }
    }

    public static void process(Scanner sc) {
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
            c[i] = sc.nextInt();
        }

        int last = a[0];
        System.out.print(last);
        for (int i = 1; i < n-1; i++) {
            if (a[i] != last) {
                last = a[i];
            }
            else {
                last = b[i];
            }
            System.out.print(" " + last);
        }
        if (a[n-1] != last && a[n-1] != a[0]) {
            last = a[n-1];
        }
        else if (b[n-1] != last && b[n-1] != a[0]) {
            last = b[n-1];
        }
        else {
            last = c[n-1];
        }
        System.out.println(" " + last);
    }
}


import java.io.*;
import java.util.*;
public class MyClass {

    public static void main(String args[]) {
      FastReader sc = new FastReader();     //For Fast IO
      StringBuilder sb = new StringBuilder();
      int t = sc.nextInt();
      while(t-->0){
          int n = sc.nextInt();
          HashSet<Integer> hs = new HashSet<>();
          for(int i=0;i<3*n;i++){
              int x = sc.nextInt();
              hs.add(x);
          }
          int count=0;
          ArrayList<Integer> ans = new ArrayList<>();
          while(count<n){
              for(Integer num : hs){
                ans.add(num);
                count++;
              if(count==n){
                  break;
              }
            }
            if(count==n){
                break;
            }
          }
          if(ans.get(ans.size()-1) == ans.get(0)){
              ans.remove(ans.size()-1);
              ans.add(ans.get(1));
          }
          for(int i=0;i<ans.size();i++){
              sb.append(ans.get(i)+" ");
          }
          sb.append("\n");
      }
      System.out.println(sb);
    }
}
class Pair{
    int x;
    int y;
    Pair(int i,int j){
        x=i;
        y=j;
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Pair)) return false;
        Pair key = (Pair) o;
        return x == key.x && y == key.y;
    }
    @Override
    public int hashCode() {
        int result = x;
        result = 31*result + y;
        return result;
    }
}
class FastReader
	{
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new
					InputStreamReader(System.in));
		}

		String next()
		{
			while (st == null || !st.hasMoreElements())
			{
				try
				{
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}

		long nextLong()
		{
			return Long.parseLong(next());
		}

		double nextDouble()
		{
			return Double.parseDouble(next());
		}

		String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}
	}


import java.io.*;
import java.util.*;
public class MyClass {

    public static void main(String args[]) {
      FastReader sc = new FastReader();     //For Fast IO
      StringBuilder sb = new StringBuilder();
      int t = sc.nextInt();
      while(t-->0){
          int n = sc.nextInt();
          ArrayList<Integer> ans = new ArrayList<>();
          int f=0;
          int a1[] = new int[n];
          int a2[] = new int[n];
          int a3[] = new int[n];
          for(int i=0;i<n;i++){
              int x = sc.nextInt();
              a1[i]=x;
          }
          for(int i=0;i<n;i++){
              int x = sc.nextInt();
              a2[i]=x;
          }
          for(int i=0;i<n;i++){
              int x = sc.nextInt();
              a3[i]=x;
          }
          ans.add(a1[0]);
          int last=a1[0];
          for(int i=1;i<n;i++){
              if(last==a1[i]){
                  if(last==a2[i]){
                      ans.add(a3[i]);
                      last=a3[i];
                  }
                  else{
                      ans.add(a2[i]);
                      last=a2[i];
                  }
              }
              else{
                  ans.add(a1[i]);
                  last=a1[i];
              }
          }
          if(ans.get(ans.size()-1) == ans.get(0)){
              ans.remove(ans.size()-1);
              int x = ans.get(ans.size()-1);
              if(a1[n-1] != x && a1[n-1] != ans.get(0)){
                  ans.add(a1[n-1]);
              }
              else if(a2[n-1] != x && a2[n-1] != ans.get(0)){
                  ans.add(a2[n-1]);
              }
              else{
                  ans.add(a3[n-1]);
              }
          }
          for(int i=0;i<ans.size();i++){
              sb.append(ans.get(i)+" ");
          }
          sb.append("\n");
      }
      System.out.println(sb);
    }
}
class Pair{
    int x;
    int y;
    Pair(int i,int j){
        x=i;
        y=j;
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Pair)) return false;
        Pair key = (Pair) o;
        return x == key.x && y == key.y;
    }
    @Override
    public int hashCode() {
        int result = x;
        result = 31*result + y;
        return result;
    }
}
class FastReader
	{
		BufferedReader br;
		StringTokenizer st;

		public FastReader()
		{
			br = new BufferedReader(new
					InputStreamReader(System.in));
		}

		String next()
		{
			while (st == null || !st.hasMoreElements())
			{
				try
				{
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(next());
		}

		long nextLong()
		{
			return Long.parseLong(next());
		}

		double nextDouble()
		{
			return Double.parseDouble(next());
		}

		String nextLine()
		{
			String str = "";
			try
			{
				str = br.readLine();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
			return str;
		}
	}


//package codeforce.company.graknforces2020;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class A_CircleColoring {

  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int t = sc.nextInt();
      for (int i = 0; i < t; i++) {
        int n = sc.nextInt();
        List<Integer> p = new ArrayList<>();
        for (int j = 0; j < 3 * n; j++) {
          p.add(sc.nextInt());
        }
        Collections.sort(p);
        if(n == 1) {
          System.out.println(p.get(0) + " " + p.get(1) + " " + p.get(2));
        } else {
          for (int j = 0; j < n / 2; j++) {
            System.out.print(p.get(j) + " ");
            System.out.print(p.get(3 * n - j - 1) + " ");
            if (n % 2 == 1 && j == n / 2 - 1) {
              System.out.print(p.get(j + 1));
            }
          }
          System.out.println();
        }
      }

    }
  }
}


//package codeforce.company.graknforces2020;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class A_CircleColoring {

  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int t = sc.nextInt();
      for (int i = 0; i < t; i++) {
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int j = 0; j < n; j++) {
          a[j] = sc.nextInt();
        }
        int[] b = new int[n];
        for (int j = 0; j < n; j++) {
          b[j] = sc.nextInt();
        }
        int[] c = new int[n];
        for (int j = 0; j < n; j++) {
          c[j] = sc.nextInt();
        }
        int[] p = new int[n];
        p[0] = a[0];
        for (int j = 1; j < n; j++) {
          if(a[j] != p[j-1])
            p[j] = a[j];
          else if(b[j] != p[j-1])
            p[j] = b[j];
          else
            p[j] = c[j];
        }

        for (int j = 0; j < n; j++) {
          System.out.print(p[j] + " ");
        }

        System.out.println();
      }

    }
  }
}


//package codeforce.company.graknforces2020;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class A_CircleColoring {

  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int t = sc.nextInt();
      for (int i = 0; i < t; i++) {
        int n = sc.nextInt();
        Set<Integer> p = new TreeSet<>();
        for (int j = 0; j < 3 * n; j++) {
          p.add(sc.nextInt());
        }
        int cnt = 0;
        for (Integer aa : p) {
          System.out.print(aa + " ");
          cnt++;
          if(cnt == n)
            break;
        }
        System.out.println();
      }

    }
  }
}


//package codeforce.company.graknforces2020;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class A_CircleColoring {

  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int t = sc.nextInt();
      for (int i = 0; i < t; i++) {
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int j = 0; j < n; j++) {
          a[j] = sc.nextInt();
        }
        int[] b = new int[n];
        for (int j = 0; j < n; j++) {
          b[j] = sc.nextInt();
        }
        int[] c = new int[n];
        for (int j = 0; j < n; j++) {
          c[j] = sc.nextInt();
        }
        int[] p = new int[n];
        p[0] = a[0];
        for (int j = 1; j < n; j++) {
          if (a[j] != p[j - 1])
            p[j] = a[j];
          else if (b[j] != p[j - 1])
            p[j] = b[j];
          else
            p[j] = c[j];
        }

        if (p[0] == p[n - 1]) {
          if (a[n - 1] != p[0] && a[n-1] != p[n-2])
            p[n - 1] = a[n - 1];
          else if (b[n - 1] != p[0] && b[n-1] != p[n-2])
            p[n - 1] = b[n - 1];
          else
            p[n - 1] = c[n - 1];
        }

        for (int j = 0; j < n; j++) {
          System.out.print(p[j] + " ");
        }

        System.out.println();
      }

    }
  }
}


//package codeforce.company.graknforces2020;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class A_CircleColoring {

  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int t = sc.nextInt();
      for (int i = 0; i < t; i++) {
        int n = sc.nextInt();
        List<Integer> p = new ArrayList<>();
        for (int j = 0; j < 3 * n; j++) {
          p.add(sc.nextInt());
        }
        Collections.sort(p);
        for (int j = 0; j < n / 2; j++) {
          System.out.print(p.get(j) + " ");
          System.out.print(p.get(3 * n - j - 1) + " ");
          if(n % 2 == 1 && j == n/2 - 1) {
            System.out.print(p.get(j+1));
          }
        }
        System.out.println();
      }

    }
  }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class fib {
	//static int r;
	static int aa, bb;
	static String x;
	static int inp[];
	static int len ;
	static long[][][] dp;

	public static long dp(int ind, int count, int exp) {
		if(ind==len) {
			if (count==0)
				return 0;
			else
				return (long) 1e9;
		}
		if (dp[ind][count][exp]!=(long) 1e9)
			return dp[ind][count][exp];
		if (inp[ind]==0) {
			if(count!=0) {

				long a = dp(ind+1,count+1,0)+bb;
				long b = dp(ind+1,0,1)+aa+bb;
				return dp[ind][count][exp] = Math.min(a, b);

			}

			return dp[ind][count][exp] = dp(ind+1,count,0);

		}else {
			if(exp==1)
			return dp[ind][count][exp] = dp(ind+1,0,1);
			else
				{long a= dp(ind+1,0,1)+aa;
				long b= dp(ind+1,count+1,0);
				return dp[ind][count][exp]= Math.min(a, b);
				}
		}
	}

	public static long gcd(long i, long j) {
		if (j == 0)
			return i;
		return gcd(j, i % j);
	}

	public static int gcd(int i, int j) {
		if (j == 0)
			return i;
		return gcd(j, i % j);
	}

	public static long pow(int a, int e) {
		long res = 1;
		while (e != 0) {
			if ((e & 1) == 1)
				res = res * a;
			a = a * a;
			e >>= 1;

		}
		return res;
	}

	public static long perms(long x, int k) {
		long powerd = pow(10, (x + "").length() - 1);
		long nine = pow(9, (x + "").length() - 1);

		long b = x / powerd;

		if (b == k)
			return b * nine;
		if (b > k) {
			if ((x + "").length() == 1)
				return b;
			return (b - 1) * nine + perms(x % powerd, k);
		}
		if ((x + "").length() == 1)
			return b + 1;
		return (b) * nine + perms(x % powerd, k);

	}

	public static long zerperms(long x, int k) {
		long powerd = pow(10, (x + "").length() - 1);
		long nine = pow(9, (x + "").length() - 1);

		long b = x / powerd;

		if ((x + "").length() == 1)
			return b;
		return b * nine + perms(x % powerd, 0);

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = Integer.parseInt(next());
			}
			return arr;
		}

		public boolean ready() {
			try {
				return br.ready();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}

		}
	}

	public static void main(String[] args) throws InterruptedException, IOException {

		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int t = sc.nextInt();

		while (t-- > 0) {
			int n = sc.nextInt();
			int[] a = new int [n];
			int[] b = new int [n];
			int[] c = new int [n];
			for(int i=0;i<n;i++)
				a[i]=sc.nextInt();
			for(int i=0;i<n;i++)
				b[i]=sc.nextInt();
			for(int i=0;i<n;i++)
				c[i]=sc.nextInt();
			int []res =new int[n];
			res [0]= a[0];
			char sel ='a';
			for(int i = 1;i<n-1;i++) {
				if (a[i]==res[i-1])
				{
					res[i]=b[i];

				}
				else
					res[i]=a[i];
			}
			if(a[n-1]!=res[n-2]&&a[n-1]!=res[0]) {
				res[n-1]=a[n-1];
			}
			else
				if(b[n-1]!=res[n-2]&&b[n-1]!=res[0]) {
					res[n-1]=b[n-1];
				}
				else
					res[n-1]=c[n-1];

			for(int i=0;i<n;i++)
				pw.print(res[i]+" ");
			pw.println();
		}
		// pw.println(perms(tmp, k)-1);

		pw.close();

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class fib {
	//static int r;
	static int aa, bb;
	static String x;
	static int inp[];
	static int len ;
	static long[][][] dp;

	public static long dp(int ind, int count, int exp) {
		if(ind==len) {
			if (count==0)
				return 0;
			else
				return (long) 1e9;
		}
		if (dp[ind][count][exp]!=(long) 1e9)
			return dp[ind][count][exp];
		if (inp[ind]==0) {
			if(count!=0) {

				long a = dp(ind+1,count+1,0)+bb;
				long b = dp(ind+1,0,1)+aa+bb;
				return dp[ind][count][exp] = Math.min(a, b);

			}

			return dp[ind][count][exp] = dp(ind+1,count,0);

		}else {
			if(exp==1)
			return dp[ind][count][exp] = dp(ind+1,0,1);
			else
				{long a= dp(ind+1,0,1)+aa;
				long b= dp(ind+1,count+1,0);
				return dp[ind][count][exp]= Math.min(a, b);
				}
		}
	}

	public static long gcd(long i, long j) {
		if (j == 0)
			return i;
		return gcd(j, i % j);
	}

	public static int gcd(int i, int j) {
		if (j == 0)
			return i;
		return gcd(j, i % j);
	}

	public static long pow(int a, int e) {
		long res = 1;
		while (e != 0) {
			if ((e & 1) == 1)
				res = res * a;
			a = a * a;
			e >>= 1;

		}
		return res;
	}

	public static long perms(long x, int k) {
		long powerd = pow(10, (x + "").length() - 1);
		long nine = pow(9, (x + "").length() - 1);

		long b = x / powerd;

		if (b == k)
			return b * nine;
		if (b > k) {
			if ((x + "").length() == 1)
				return b;
			return (b - 1) * nine + perms(x % powerd, k);
		}
		if ((x + "").length() == 1)
			return b + 1;
		return (b) * nine + perms(x % powerd, k);

	}

	public static long zerperms(long x, int k) {
		long powerd = pow(10, (x + "").length() - 1);
		long nine = pow(9, (x + "").length() - 1);

		long b = x / powerd;

		if ((x + "").length() == 1)
			return b;
		return b * nine + perms(x % powerd, 0);

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = Integer.parseInt(next());
			}
			return arr;
		}

		public boolean ready() {
			try {
				return br.ready();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}

		}
	}

	public static void main(String[] args) throws InterruptedException, IOException {

		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int t = sc.nextInt();

		while (t-- > 0) {
			int n = sc.nextInt();
			int[] a = new int [n];
			int[] b = new int [n];
			int[] c = new int [n];
			for(int i=0;i<n;i++)
				a[i]=sc.nextInt();
			for(int i=0;i<n;i++)
				b[i]=sc.nextInt();
			for(int i=0;i<n;i++)
				c[i]=sc.nextInt();
			int []res =new int[n];
			res [0]= a[0];
			char sel ='a';
			for(int i = 1;i<n-1;i++) {
				if (a[i]==res[i-1])
				{
					res[i]=b[i];

				}
				else
					res[i]=a[i];
			}
			if(a[n-1]!=res[n-2]&&a[n-1]!=res[0]) {
				res[n-1]=a[n-1];
			}
			else
				if(b[n-1]!=res[n-2]&&b[n-1]!=res[0]) {
					res[n-1]=b[n-1];
				}
				else
					res[n-1]=c[n-1];

			for(int i=0;i<n;i++)
				pw.print(res[i]+' ');
			pw.println();
		}
		// pw.println(perms(tmp, k)-1);

		pw.close();

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class fib {
	//static int r;
	static int aa, bb;
	static String x;
	static int inp[];
	static int len ;
	static long[][][] dp;

	public static long dp(int ind, int count, int exp) {
		if(ind==len) {
			if (count==0)
				return 0;
			else
				return (long) 1e9;
		}
		if (dp[ind][count][exp]!=(long) 1e9)
			return dp[ind][count][exp];
		if (inp[ind]==0) {
			if(count!=0) {

				long a = dp(ind+1,count+1,0)+bb;
				long b = dp(ind+1,0,1)+aa+bb;
				return dp[ind][count][exp] = Math.min(a, b);

			}

			return dp[ind][count][exp] = dp(ind+1,count,0);

		}else {
			if(exp==1)
			return dp[ind][count][exp] = dp(ind+1,0,1);
			else
				{long a= dp(ind+1,0,1)+aa;
				long b= dp(ind+1,count+1,0);
				return dp[ind][count][exp]= Math.min(a, b);
				}
		}
	}

	public static long gcd(long i, long j) {
		if (j == 0)
			return i;
		return gcd(j, i % j);
	}

	public static int gcd(int i, int j) {
		if (j == 0)
			return i;
		return gcd(j, i % j);
	}

	public static long pow(int a, int e) {
		long res = 1;
		while (e != 0) {
			if ((e & 1) == 1)
				res = res * a;
			a = a * a;
			e >>= 1;

		}
		return res;
	}

	public static long perms(long x, int k) {
		long powerd = pow(10, (x + "").length() - 1);
		long nine = pow(9, (x + "").length() - 1);

		long b = x / powerd;

		if (b == k)
			return b * nine;
		if (b > k) {
			if ((x + "").length() == 1)
				return b;
			return (b - 1) * nine + perms(x % powerd, k);
		}
		if ((x + "").length() == 1)
			return b + 1;
		return (b) * nine + perms(x % powerd, k);

	}

	public static long zerperms(long x, int k) {
		long powerd = pow(10, (x + "").length() - 1);
		long nine = pow(9, (x + "").length() - 1);

		long b = x / powerd;

		if ((x + "").length() == 1)
			return b;
		return b * nine + perms(x % powerd, 0);

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = Integer.parseInt(next());
			}
			return arr;
		}

		public boolean ready() {
			try {
				return br.ready();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}

		}
	}

	public static void main(String[] args) throws InterruptedException, IOException {

		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int t = sc.nextInt();

		while (t-- > 0) {
			int n = sc.nextInt();
			int[] a = new int [n];
			int[] b = new int [n];
			int[] c = new int [n];
			for(int i=0;i<n;i++)
				a[i]=sc.nextInt();
			for(int i=0;i<n;i++)
				b[i]=sc.nextInt();
			for(int i=0;i<n;i++)
				c[i]=sc.nextInt();
			int []res =new int[n];
			res [0]= a[0];
			char sel ='a';
			for(int i = 1;i<n-1;i++) {
				if (a[i]==res[i-1])
				{
					res[i]=b[i];

				}
				else
					res[i]=a[i];
			}
			if(a[n-1]!=res[n-2]&&a[n-1]!=res[0]) {
				res[n-1]=a[n-1];
			}
			else
				if(b[n-1]!=res[n-2]&&b[n-1]!=res[0]) {
					res[n-1]=b[n-1];
				}
				else
					res[n-1]=c[n-1];

			for(int i=0;i<n;i++)
				pw.print(res[i]);
			pw.println();
		}
		// pw.println(perms(tmp, k)-1);

		pw.close();

	}

}


import java.util.*;
public class Main {
    public static void main(String[] args) {
        int t = 0;
        Scanner sc = new Scanner(System.in);
        t = sc.nextInt();
        while(t-->0){
            int n = sc.nextInt();
            int[] a = new int[n];
            int[] b = new int[n];
            int[] c = new int[n];
            for(int i = 0 ; i<n ; i++)a[i]=sc.nextInt();
            for(int i = 0 ; i<n ; i++)b[i]=sc.nextInt();
            for(int i = 0 ; i<n ; i++)c[i]=sc.nextInt();
            int res[] = new int[n];
            res[0]=a[0];
            for(int m = 1 ; m<n ; m++){
                if(res[m-1]!=b[m])res[m]=b[m];
                else if(res[m-1]!=c[m])res[m]=c[m];
                else if(res[m-1]!=a[m])res[m]=a[m];
            }
            if(res[0]==res[n-1]){
                if(a[n-1]!=res[n-1]&&res[n-2]!=a[n-1])res[n-1]=a[n-1];
                else if(b[n-1]!=res[n-1]&&res[n-2]!=b[n-1])res[n-1]=b[n-1];
                else if(c[n-1]!=res[n-1]&&res[n-2]!=c[n-1])res[n-1]=c[n-1];
            }
            for(int ans : res)System.out.print(ans+" ");
            System.out.println();
        }
    }
}


import java.util.*;
public class Main {
    public static void main(String[] args) {
        int t = 0;
        Scanner sc = new Scanner(System.in);
        t = sc.nextInt();
        while(t-->0){
            int n = sc.nextInt();
            int[] a = new int[n];
            int[] b = new int[n];
            int[] c = new int[n];
            for(int i = 0 ; i<3 ; i++){
                for(int j = 0 ; j<n ; j++){
                    if(i==0)a[j]=sc.nextInt();
                    else if(i==1)b[j]=sc.nextInt();
                    else if(i==2)c[j]=sc.nextInt();
                }
            }
            int res[] = new int[n];
            res[0]=a[0];
            for(int m = 1 ; m<n ; m++){
                if(res[m-1]!=b[m])res[m]=b[m];
                else if(res[m-1]!=c[m])res[m]=c[m];
                else res[m]=a[m];
            }
            if(res[0]==res[n-1]){
                if(a[n-1]!=res[n-1]&&a[n-2]!=res[n-1])res[n-1]=a[n-1];
                else if(b[n-1]!=res[n-1]&&b[n-2]!=res[n-1])res[n-1]=b[n-1];
                else if(c[n-1]!=res[n-1]&&c[n-2]!=res[n-1])res[n-1]=c[n-1];
            }
            for(int ans : res)System.out.print(ans+" ");
            System.out.println();
        }
    }
}


import java.util.*;
public class Main {
    public static void main(String[] args) {
        int t = 0;
        Scanner sc = new Scanner(System.in);
        t = sc.nextInt();
        while(t-->0){
            int n = sc.nextInt();
            int[] a = new int[n];
            int[] b = new int[n];
            int[] c = new int[n];
            for(int i = 0 ; i<3 ; i++){
                for(int j = 0 ; j<n ; j++){
                    if(i==0)a[j]=sc.nextInt();
                    else if(i==1)b[j]=sc.nextInt();
                    else if(i==2)c[j]=sc.nextInt();
                }
            }
            int res[] = new int[n];
            res[0]=a[0];
            for(int m = 1 ; m<n ; m++){
                if(res[m-1]!=b[m])res[m]=b[m];
                else if(res[m-1]!=c[m])res[m]=c[m];
                else if(res[m-1]!=a[m])res[m]=a[m];
            }
            if(res[0]==res[n-1]){
                if(a[n-1]!=res[n-1]&&a[n-2]!=res[n-1])res[n-1]=a[n-1];
                else if(b[n-1]!=res[n-1]&&b[n-2]!=res[n-1])res[n-1]=b[n-1];
                else if(c[n-1]!=res[n-1]&&c[n-2]!=res[n-1])res[n-1]=c[n-1];
            }
            for(int ans : res)System.out.print(ans+" ");
            System.out.println();
        }
    }
}


import java.util.*;
public class Main {
    public static void main(String[] args) {
        int t = 0;
        Scanner sc = new Scanner(System.in);
        t = sc.nextInt();
        while(t-->0){
            int n = sc.nextInt();
            int[] a = new int[n];
            int[] b = new int[n];
            int[] c = new int[n];
            for(int i = 0 ; i<n ; i++)a[i]=sc.nextInt();
            for(int i = 0 ; i<n ; i++)b[i]=sc.nextInt();
            for(int i = 0 ; i<n ; i++)c[i]=sc.nextInt();
            int res[] = new int[n];
            res[0]=a[0];
            for(int m = 1 ; m<n ; m++){
                if(res[m-1]!=b[m])res[m]=b[m];
                else if(res[m-1]!=c[m])res[m]=c[m];
                else if(res[m-1]!=a[m])res[m]=a[m];
            }
            if(res[0]==res[n-1]){
                if(a[n-1]!=res[n-1]&&a[n-2]!=res[n-1])res[n-1]=a[n-1];
                else if(b[n-1]!=res[n-1]&&b[n-2]!=res[n-1])res[n-1]=b[n-1];
                else if(c[n-1]!=res[n-1]&&c[n-2]!=res[n-1])res[n-1]=c[n-1];
            }
            for(int ans : res)System.out.print(ans+" ");
            System.out.println();
        }
    }
}


import java.util.*;
public class Main {
    public static void main(String[] args) {
        int t = 0;
        Scanner sc = new Scanner(System.in);
        t = sc.nextInt();
        while(t-->0){
            int n = sc.nextInt();
            HashSet<Integer> set = new HashSet<>();
            for(int i = 0 ; i<3 ; i++){
                for(int j = 0 ; j<n ; j++){
                    int input = sc.nextInt();
                    set.add(input);
                }
            }
            int[] arr = new int[n];
            int index = 0;
            while(index<n){
                for(int i : set){
                    if(index<n)arr[index++]=i;
                    else break;
                    //System.out.print(i);index++;
                }
            }
            if(arr[0]==arr[n-1]){
                for(int m : set){
                    if(arr[0]!=m&&arr[1]!=m){
                        arr[0]=m;
                        break;
                    }
                }
            }
            for(int k:arr)System.out.print(k+" ");
            System.out.println();
        }
    }
}


import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Main {

    public static void main(String[] args) {

    	FastScanner scan = new FastScanner();

    	int t = scan.nextInt();
    	for(int tt=0; tt<t; tt++) {
    		int n = scan.nextInt();
    		int [] a = scan.readArray(n), b = scan.readArray(n), c = scan.readArray(n), p = new int[n];

    	outer:	for(int i=0; i<n; i++) {
    			if(i == 0) {
    				p[i] = a[0];
    				continue outer;
    			}

    			//scan through a
    			for(int j=0; j<n; j++) {
    				if(a[j] != p[i-1] && a[j] != p[(j % n) + 1]) {
    					p[i] = a[j];
    					continue outer;
    				}
    				if(b[j] != p[i-1] && b[j] != p[(j % n) + 1]) {
    					p[i] = b[j];
    					continue outer;
    				}
    				if(c[j] != p[i-1] && c[j] != p[(j % n) + 1]) {
    					p[i] = c[j];
    					continue outer;
    				}
    			}

    		}
    		for(int j = 0; j<n; j++) System.out.print(p[j] + " ");
    		System.out.println();
    	}
    }

    static class FastScanner{

    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer st = new StringTokenizer("");
    	String next() {
    		while(!st.hasMoreTokens())
    			try {
    				st = new StringTokenizer(br.readLine());
    			} catch (IOException e){
    				e.printStackTrace();
    			}
    		return st.nextToken();
    	}

    	int nextInt() {
    		return Integer.parseInt(next());
    	}

    	int [] readArray(int n) {
    		int [] a = new int[n];
    		for(int i=0; i<n ; i++) a[i] = nextInt();
    		return a;
    	}

    	long nextLong() {
    		return Long.parseLong(next());
    	}

    }

}


import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Main {

    public static void main(String[] args) {

    	FastScanner scan = new FastScanner();

    	int t = scan.nextInt();
    	for(int tt=0; tt<t; tt++) {
    		int n = scan.nextInt();
    		int [] a = scan.readArray(n), b = scan.readArray(n), c = scan.readArray(n);
    		int [] arr = new int [n];
    		arr[0] = a[0];

    		for(int i=1; i<n; i++) {
    			int pre = arr[i-1];
    			if(i != n+1) {
    				int next = arr[0];
    				if(a[i] != next && a[i] != pre) arr[i] = a[i];
    				else if(b[i] != next && b[i] != pre) arr[i] = b[i];
    				else arr[i] = c[i];
    			} else {
    				if(a[i] != pre) arr[i] = a[i];
    				else arr[i] = b[i];
    			}
    		}
    		for(int i=0; i<n; i++) System.out.print(arr[i]+ " ");
    		System.out.println();
    	}
    }

    static class FastScanner{

    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer st = new StringTokenizer("");
    	String next() {
    		while(!st.hasMoreTokens())
    			try {
    				st = new StringTokenizer(br.readLine());
    			} catch (IOException e){
    				e.printStackTrace();
    			}
    		return st.nextToken();
    	}

    	int nextInt() {
    		return Integer.parseInt(next());
    	}

    	int [] readArray(int n) {
    		int [] a = new int[n];
    		for(int i=0; i<n ; i++) a[i] = nextInt();
    		return a;
    	}

    	long nextLong() {
    		return Long.parseLong(next());
    	}

    }

}


import java.io.*;
import java.util.Scanner;
public class circle
{
    public static void main(String args[])
    {
        Scanner in=new Scanner(System.in);
        int t,n;
        t=in.nextInt();
        for(int i=t;i>0;i--)
        {
            n=in.nextInt();
            int a[]=new int[n];
            int b[]=new int[n];
            int c[]=new int[n];
            int p[]=new int[n];
            for(int j=0;j<n;j++)
            {
                a[j]=in.nextInt();
            }
            for(int j=0;j<n;j++)
            {
                b[j]=in.nextInt();
            }
            for(int j=0;j<n;j++)
            {
                c[j]=in.nextInt();
            }
            p[0]=a[0];
            for(int j=1;j<n-1;j++)
            {
                if(p[j-1]!=a[j])
                p[j]=a[j];
                else if(p[j-1]!=b[j])
                p[j]=b[j];
                else
                p[j]=c[j];
            }
            if((p[n-2]!=a[n-1])&&(a[n-1]!=p[0]))
            p[n-1]=a[n-1];
            else if((p[n-2]!=b[n-1])&&(b[n-1]!=p[0]))
            p[n-1]=b[n-1];
            else
            p[n-1]=c[n-1];
            for(int j=0;j<n;j++)
            {
                System.out.print(c[j]+" ");
            }
        }
    }
}


import java.io.*;
import java.util.Scanner;
public class circle
{
    public static void main(String args[])
    {
        Scanner in=new Scanner(System.in);
        int t,n;
        t=in.nextInt();
        for(int i=t;i>0;i--)
        {
            n=in.nextInt();
            int a[]=new int[n];
            int b[]=new int[n];
            int c[]=new int[n];
            int p[]=new int[n];
            for(int j=0;j<n;j++)
            {
                a[j]=in.nextInt();
            }
            for(int j=0;j<n;j++)
            {
                b[j]=in.nextInt();
            }
            for(int j=0;j<n;j++)
            {
                c[j]=in.nextInt();
            }
            p[0]=a[0];
            for(int j=1;j<n-1;j++)
            {
                if(p[j-1]!=a[j])
                p[j]=a[j];
                else if(p[j-1]!=b[j])
                p[j]=b[j];
                else
                p[j]=c[j];
            }
            if((p[n-2]!=a[n-1])&&(a[n-1]!=p[0])
            p[n-1]=a[n-1];
            else if((p[n-2]!=b[n-1])&&(b[n-1]!=p[0])
            p[n-1]=b[n-1];
            else
            p[n-1]=c[n-1];
            for(int j=0;j<n;j++)
            {
                System.out.print(c[j]+" ");
            }
        }
    }
}


import java.io.*;
import java.util.Scanner;
public class circle
{
    public static void main(String args[])
    {
        Scanner in=new Scanner(System.in);
        int t,n;
        t=in.nextInt();
        for(int i=t;i>0;i--)
        {
            n=in.nextInt();
            int a[]=new int[n];
            int b[]=new int[n];
            int c[]=new int[n];
            int p[]=new int[n];
            for(int j=0;j<n;j++)
            {
                a[j]=in.nextInt();
            }
            for(int j=0;j<n;j++)
            {
                b[j]=in.nextInt();
            }
            for(int j=0;j<n;j++)
            {
                c[j]=in.nextInt();
            }
            p[0]=a[0];
            for(int j=1;j<n-1;j++)
            {
                if(p[j-1]!=a[j])
                p[j]=a[j];
                else if(p[j-1]!=b[j])
                p[j]=b[j];
                else
                p[j]=c[j];
            }
            if((p[n-2]!=a[n-1])&&(a[n-1]!=p[0]))
            p[n-1]=a[n-1];
            else if((p[n-2]!=b[n-1])&&(b[n-1]!=p[0]))
            p[n-1]=b[n-1];
            else
            p[n-1]=c[n-1];
            for(int j=0;j<n;j++)
            {
                System.out.print(p[j]+" ");
            }
        }
        System.out.println();
    }
}


import java.io.*;
import java.util.Scanner;
public class circle
{
    public static void main(String args[])
    {
        Scanner in=new Scanner(System.in);
        int t,n;
        t=in.nextInt();
        for(int i=t;i>0;i--)
        {
            n=in.nextInt();
            int a[]=new int[n];
            int b[]=new int[n];
            int c[]=new int[n];
            int p[]=new int[n];
            for(int j=0;j<n;j++)
            {
                a[j]=in.nextInt();
            }
            for(int j=0;j<n;j++)
            {
                b[j]=in.nextInt();
            }
            for(int j=0;j<n;j++)
            {
                c[j]=in.nextInt();
            }
            p[0]=a[0];
            for(int j=1;j<n-1;j++)
            {
                if(p[j-1]!=a[j])
                p[j]=a[j];
                else if(p[j-1]!=b[j])
                p[j]=b[j];
                else
                p[j]=c[j];
            }
            if((p[n-2]!=a[n-1])&&(a[n-1]!=p[0]))
            p[n-1]=a[n-1];
            else if((p[n-2]!=b[n-1])&&(b[n-1]!=p[0]))
            p[n-1]=b[n-1];
            else
            p[n-1]=c[n-1];
            for(int j=0;j<n;j++)
            {
                System.out.print(c[j]+" ");
            }
        }
        System.out.println();
    }
}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package solutiona;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
//import javafx.util.Pair;

public class SolutionA
{

            public static void main(String[] args) {
        FastScanner fs=new FastScanner();
        int t=fs.nextInt();
        int tc=0;
        while(t-->0)
        {
            int n=fs.nextInt();
            int a[]=fs.readArray(n);
            int b[]=fs.readArray(n);
            int c[]=fs.readArray(n);
            int ans[]=new int[n];
            ans[0]=a[0];
            for(int i=1;i<n;i++)
            {
                if(i!=n-1 &&a[i]!=ans[i-1])
                {
                    ans[i]=a[i];
                }
                else if(i==n-1 &&a[i]!=ans[i-1] &&a[i]!=ans[0])
                {
                    ans[i]=a[i];
                }
                else if(i!=n-1 &&b[i]!=ans[i-1])
                {
                    ans[i]=b[i];
                }
                else if(i==n-1 &&b[i]!=ans[i-1] &&b[i]!=ans[0])
                {
                    ans[i]=b[i];
                }
                else
                {
                    ans[i]=c[i];
                }
            }
            for(int i=0;i<n;i++)
            {
                System.out.print(ans[i]+" ");
            }
            System.out.println("");

        }
    }
     static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();

		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public long[] readLongArray(int n) {
			long[] a=new long[n];
			for (int i=0; i<n; i++) a[i]=nextLong();
			return a;
		}
	}

}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package solutiona;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
//import javafx.util.Pair;

public class SolutionA
{

            public static void main(String[] args) {
        FastScanner fs=new FastScanner();
        int t=fs.nextInt();
        int tc=0;
        while(t-->0)
        {
            int n=fs.nextInt();
            int a[]=fs.readArray(n);
            int b[]=fs.readArray(n);
            int c[]=fs.readArray(n);
            int ans[]=new int[n];
            ans[0]=a[0];
            for(int i=1;i<n;i++)
            {
                if(a[i]!=ans[i-1])
                {
                    ans[i]=a[i];
                }
                else if(b[i]!=ans[i-1])
                {
                    ans[i]=b[i];
                }
                else
                {
                    ans[i]=c[i];
                }
            }
            for(int i=0;i<n;i++)
            {
                System.out.print(ans[i]+" ");
            }
            System.out.println("");

        }
    }
     static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");

		public String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();

		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public long[] readLongArray(int n) {
			long[] a=new long[n];
			for (int i=0; i<n; i++) a[i]=nextLong();
			return a;
		}
	}

}


import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.util.InputMismatchException;
public class A
{
    public static void solve()
    {
        int t=sc.nextInt();
        while (t-->0)
        {
           int n=sc.nextInt();
           int[] a=sc.nextIntArray(n);
           int[] b=sc.nextIntArray(n);
           int[] c=sc.nextIntArray(n);
           int[] p=new int[n];
           p[0]=a[0];
           for (int i=1;i<n-1;i++)
           {
        	   if (a[i]==p[i-1])
        	   {
        		  if (b[i]==p[i-1])
        		  {
        			  p[i]=c[i];
        		  }
        		  else
        		  {
        			  p[i]=b[i];
        		  }
        	   }
        	   else
        	   {
        		   p[i]=a[i];
        	   }
           }
           if (a[n-1]!=p[0]) p[n-1]=a[n-1];
           else if (b[n-1]!=p[0]) p[n-1]=b[n-1];
           else p[n-1]=c[n-1];
           for (int each:p) out.print(each+" ");
           out.println();
        }
    }
    public static void main(String[] args)
    {
        new Thread(null, null, "Thread", 1 << 27)
        {
            public void run()
            {
                try
                {
                    out = new PrintWriter(new BufferedOutputStream(System.out));
                    sc = new FastReader(System.in);
                    solve();
                    out.close();
                }
                catch (Exception e)
                {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }
                .start();
    }
    static final Random random=new Random();
    static int gcd(int a,int b)
    {
        if (b==a)
            return a;
        return gcd(b,a%b);
    }
    static void UjjwalSort(int[] a)
    {
        int n=a.length;//shuffle, then sort
        for (int i=0; i<n; i++)
        {
            int ujjwal=random.nextInt(n), temp=a[ujjwal];
            a[ujjwal]=a[i]; a[i]=temp;
        }
        Arrays.sort(a);
    }
    public static PrintWriter out;
    public static FastReader sc;
    public static class FastReader
    {
        private InputStream stream;
        private byte[] buf = new byte[4096];
        private int curChar, snumChars;
        public FastReader(InputStream stream)
        {
            this.stream = stream;
        }
        public int read()
        {
            if (snumChars == -1)
            {
                throw new InputMismatchException();
            }
            if (curChar >= snumChars)
            {
                curChar = 0;
                try
                {
                    snumChars = stream.read(buf);
                }
                catch (IOException E)
                {
                    throw new InputMismatchException();
                }
            }
            if (snumChars <= 0)
            {
                return -1;
            }
            return buf[curChar++];
        }
        public int nextInt()
        {
            int c = read();
            while (isSpaceChar(c))
            {
                c = read();
            }
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            int number = 0;
            do
            {
                number *= 10;
                number += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return number * sgn;
        }
        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
            {
                c = read();
            }
            long sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            long number = 0;
            do
            {
                number *= 10L;
                number += (long) (c - '0');
                c = read();
            } while (!isSpaceChar(c));
            return number * sgn;
        }
        public int[] nextIntArray(int n)
        {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++)
            {
                arr[i] = this.nextInt();
            }
            return arr;
        }
        public long[] nextLongArray(int n)
        {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++)
            {
                arr[i] = this.nextLong();
            }
            return arr;
        }
        public String next()
        {
            int c = read();
            while (isSpaceChar(c))
            {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
        public String nextLine()
        {
            int c = read();
            while (isSpaceChar(c))
            {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndofLine(c));
            return res.toString();
        }
        public boolean isSpaceChar(int c)
        {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
        public boolean isEndofLine(int c)
        {
            return c == '\n' || c == '\r' || c == -1;
        }
    }
}


import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.util.InputMismatchException;
public class A
{
    public static void solve()
    {
        int t=sc.nextInt();
        while (t-->0)
        {
           int n=sc.nextInt();
           int[] a=sc.nextIntArray(n);
           int[] b=sc.nextIntArray(n);
           int[] c=sc.nextIntArray(n);
           int[] p=new int[n];
           p[0]=a[0];
           for (int i=1;i<n-1;i++)
           {
        	   if (a[i]==p[i-1])
        	   {
        		  if (b[i]==p[i-1])
        		  {
        			  p[i]=c[i];
        		  }
        		  else
        		  {
        			  p[i]=b[i];
        		  }
        	   }
        	   else
        	   {
        		   p[i]=a[i];
        	   }
           }
           if (a[n-1]!=p[0] && a[n-1]!=p[n-2]) p[n-1]=a[n-1];
           else if (b[n-1]!=p[0] && b[n-1]!=p[n-2]) p[n-1]=b[n-1];
           else p[n-1]=c[n-1];
           for (int each:p) out.print(each+" ");
           out.println();
        }
    }
    public static void main(String[] args)
    {
        new Thread(null, null, "Thread", 1 << 27)
        {
            public void run()
            {
                try
                {
                    out = new PrintWriter(new BufferedOutputStream(System.out));
                    sc = new FastReader(System.in);
                    solve();
                    out.close();
                }
                catch (Exception e)
                {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }
                .start();
    }
    static final Random random=new Random();
    static int gcd(int a,int b)
    {
        if (b==a)
            return a;
        return gcd(b,a%b);
    }
    static void UjjwalSort(int[] a)
    {
        int n=a.length;//shuffle, then sort
        for (int i=0; i<n; i++)
        {
            int ujjwal=random.nextInt(n), temp=a[ujjwal];
            a[ujjwal]=a[i]; a[i]=temp;
        }
        Arrays.sort(a);
    }
    public static PrintWriter out;
    public static FastReader sc;
    public static class FastReader
    {
        private InputStream stream;
        private byte[] buf = new byte[4096];
        private int curChar, snumChars;
        public FastReader(InputStream stream)
        {
            this.stream = stream;
        }
        public int read()
        {
            if (snumChars == -1)
            {
                throw new InputMismatchException();
            }
            if (curChar >= snumChars)
            {
                curChar = 0;
                try
                {
                    snumChars = stream.read(buf);
                }
                catch (IOException E)
                {
                    throw new InputMismatchException();
                }
            }
            if (snumChars <= 0)
            {
                return -1;
            }
            return buf[curChar++];
        }
        public int nextInt()
        {
            int c = read();
            while (isSpaceChar(c))
            {
                c = read();
            }
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            int number = 0;
            do
            {
                number *= 10;
                number += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return number * sgn;
        }
        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
            {
                c = read();
            }
            long sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            long number = 0;
            do
            {
                number *= 10L;
                number += (long) (c - '0');
                c = read();
            } while (!isSpaceChar(c));
            return number * sgn;
        }
        public int[] nextIntArray(int n)
        {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++)
            {
                arr[i] = this.nextInt();
            }
            return arr;
        }
        public long[] nextLongArray(int n)
        {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++)
            {
                arr[i] = this.nextLong();
            }
            return arr;
        }
        public String next()
        {
            int c = read();
            while (isSpaceChar(c))
            {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
        public String nextLine()
        {
            int c = read();
            while (isSpaceChar(c))
            {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndofLine(c));
            return res.toString();
        }
        public boolean isSpaceChar(int c)
        {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
        public boolean isEndofLine(int c)
        {
            return c == '\n' || c == '\r' || c == -1;
        }
    }
}


import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while(t-- > 0)
        {
            int n = sc.nextInt();
            int[] a = new int[n];
            int[] b = new int[n];
            int[] c = new int[n];
            int[] p = new int[n];

            for(int i = 0 ; i < n ; i++)
            a[i] = sc.nextInt();

            for(int i = 0 ; i < n ; i++)
            b[i] = sc.nextInt();

            for(int i = 0 ; i < n ; i++)
            c[i] = sc.nextInt();

            p[0] = a[0];

            for(int i = 1 ; i < n - 1; i++)
            {
                if(p[i-1] != a[i])
                {
                    p[i] = a[i];
                }
                else if(p[i-1] != b[i])
                {
                    p[i] = b[i];
                }
                else
                p[i] = c[i];
            }

            if(p[n - 2] != a[n - 1] && p[0] != a[n - 1])
                {
                    p[n - 1] = a[n - 1];
                }
            else if(p[n - 2] != b[n - 1] && p[0] != b[n - 1])
                {
                    p[n - 1] = b[n - 1];
                }
            else
                    p[n - 1] = c[n - 1];

            for(int i = 0 ; i < n ; i++)
            System.out.print(p[i] + " ");

            System.out.println();

        }
        sc.close();
    }
}


import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while(t-- > 0)
        {
            int n = sc.nextInt();
            int[] a = new int[n];
            int[] b = new int[n];
            int[] c = new int[n];
            int[] p = new int[n];

            for(int i = 0 ; i < n ; i++)
            a[i] = sc.nextInt();

            for(int i = 0 ; i < n ; i++)
            b[i] = sc.nextInt();

            for(int i = 0 ; i < n ; i++)
            c[i] = sc.nextInt();

            p[0] = a[0];

            for(int i = 1 ; i < n ; i++)
            {
                if(p[i-1] != a[i])
                {
                    p[i] = a[i];
                }
                else if(p[i-1] != b[i])
                {
                    p[i] = b[i];
                }
                else
                p[i] = c[i];
            }

            for(int i = 0 ; i < n ; i++)
            System.out.print(p[i] + " ");

            System.out.println();

        }
        sc.close();
    }
}


import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Set;

public class Codeforces1 {

    public void solve() {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        int t = in.readInt();
        while (t-- > 0) {
            int n = in.readInt();
            int a[] = IOUtils.readIntegerArray(in, n);
            int b[] = IOUtils.readIntegerArray(in, n);
            int c[] = IOUtils.readIntegerArray(in, n);
            int inp[] = new int[3 * n + 1];
            int k = 0;
            for (int i = 0; i < n; i++) {
                inp[k++] = a[i];
                if ( k > 0 && (k - 1) % 3 == 0 ) {
                    if ( inp[k] == inp[k - 1] ) {
                        int temp = inp[k];
                        inp[k] = inp[k - 1];
                        inp[k - 1] = temp;
                    }
                }
                inp[k++] = b[i];
                inp[k++] = c[i];
            }
//            int p[] = new int[n + 1];
            for (int i = 0; i < n; i++) {
                out.print(inp[i] + " ");
            }
            out.printLine();
        }
        out.flush();
    }

    public static void main(String[] args) {
        Codeforces1 solver = new Codeforces1();
        solver.solve();
    }

    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if ( numChars == -1 )
                throw new InputMismatchException();
            if ( curChar >= numChars ) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if ( numChars <= 0 )
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if ( c == '-' ) {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if ( c < '0' || c > '9' )
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if ( c == '-' ) {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if ( c < '0' || c > '9' )
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if ( filter != null )
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if ( i != 0 )
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }

    }

    static class IOUtils {

        public static int[] readIntegerArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readInt();
            }
            return array;
        }

        public static long[] readLongArray(InputReader in, int size) {
            long[] array = new long[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readLong();
            }
            return array;
        }

        public static List<Integer> readIntegerList(InputReader in, int size) {
            List<Integer> set = new ArrayList<>();
            for (int i = 0; i < size; i++) {
                set.add(in.readInt());
            }
            return set;
        }

        public static Set<Integer> readIntegerSet(InputReader in, int size) {
            Set<Integer> set = new HashSet<Integer>();
            for (int i = 0; i < size; i++) {
                set.add(in.readInt());
            }
            return set;
        }
    }
}


import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Set;

public class Codeforces1 {

    public void solve() {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        int t = in.readInt();
        while (t-- > 0) {
            int n = in.readInt();
            int a[] = IOUtils.readIntegerArray(in, n);
            int b[] = IOUtils.readIntegerArray(in, n);
            int c[] = IOUtils.readIntegerArray(in, n);
            int inp[] = new int[3 * n + 1];
            int k = 0;
            for (int i = 0; i < n; i++) {
                inp[k++] = a[i];
                if ( k >= 2 && inp[k - 1] == inp[k - 2] ) {
                    inp[k - 1] = b[i];
                }
            }
//            int p[] = new int[n + 1];
            for (int i = 0; i < n; i++) {
                out.print(inp[i] + " ");
            }
            out.printLine();
        }
        out.flush();
    }

    public static void main(String[] args) {
        Codeforces1 solver = new Codeforces1();
        solver.solve();
    }

    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if ( numChars == -1 )
                throw new InputMismatchException();
            if ( curChar >= numChars ) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if ( numChars <= 0 )
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if ( c == '-' ) {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if ( c < '0' || c > '9' )
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if ( c == '-' ) {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if ( c < '0' || c > '9' )
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if ( filter != null )
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if ( i != 0 )
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }

    }

    static class IOUtils {

        public static int[] readIntegerArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readInt();
            }
            return array;
        }

        public static long[] readLongArray(InputReader in, int size) {
            long[] array = new long[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readLong();
            }
            return array;
        }

        public static List<Integer> readIntegerList(InputReader in, int size) {
            List<Integer> set = new ArrayList<>();
            for (int i = 0; i < size; i++) {
                set.add(in.readInt());
            }
            return set;
        }

        public static Set<Integer> readIntegerSet(InputReader in, int size) {
            Set<Integer> set = new HashSet<Integer>();
            for (int i = 0; i < size; i++) {
                set.add(in.readInt());
            }
            return set;
        }
    }
}