//Problem "Snake"
//10th Internet Olympiad, season 2007-2008
//Problem Author:  Fedor Tsarev, tsarev@rain.ifmo.ru
//Solution Author: Vladimir Ulyantsev, ulyantsev@rain.ifmo.ru

import java.io.*;
import java.util.*;
import java.math.*;

public class snake_vu {
	
	static StringTokenizer st;

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new FileReader("snake.in"));
		PrintWriter out = new PrintWriter(new File("snake.out"));
		
		int n = Integer.parseInt(in.readLine());
		String s = "";
                for (int i = 0; i < n; i++) {
                	String p = in.readLine();
                	if (i % 2 == 0) {
                		s += p;
                	} else {
                		for (int j = n - 1; j >= 0; j--) {
                			s += p.charAt(j);
                		}	
                	}
                }
                String t = in.readLine();

                String ans = "NO";
                for (int i = 0; i <= s.length() - t.length(); i++) {
                	for (int j = 0; j < t.length(); j++) {
                		if (t.charAt(j) != s.charAt(i + j)) {
                			break;
                		}
                		if (j == t.length() - 1) {
                			ans = "YES";
                		}
                	}
                }

                out.println(ans);
                //out.println(s.length());

		in.close();
		out.close();
	}

}