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

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

public class snake_mb {
    public static void main(String[] args) throws IOException {
	Scanner in = new Scanner(new File("snake.in"));
	int n = in.nextInt();
	StringBuffer sb = new StringBuffer();
	for (int i = 0; i < n; ++i) {
	    StringBuffer sb2 = new StringBuffer(in.next());
	    if (i % 2 == 1) {
		sb2.reverse();
	    }
	    sb.append(sb2);
	}
	String text = in.next();
	in.close();
	
	PrintWriter out = new PrintWriter("snake.out");
	out.println(sb.toString().indexOf(text) >= 0 ? "YES" : "NO");
	out.close();
    }
}
