import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void solve (String s){ char[] charArray = s.toCharArray(); int h=0,a=0,c=0,k=0,e=0,r=0,n=0; for (char character : charArray) { if(character == 'h'){ h++; } if(character == 'a'){ a++; } if(character == 'c'){ c++; } if(character == 'k'){ k++; } if(character == 'e'){ e++; } if(character == 'r'){ r++; } if(character == 'n'){ n++; } } if(h >= 1 && a >= 2 && c >= 1 && k >= 2 && e >= 1 && r >= 2 && n >= 1){ System.out.println("YES"); }else{ System.out.println("NO"); } } public static void main(String[] args) { Scanner in = new Scanner(System.in); int q = in.nextInt(); in.nextLine(); solve(in.nextLine()); solve(in.nextLine()); } }