#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int array[17];
  char mat[4][5];
  int k;
  cin >> k;
  k *= 2;
  static int counter;
  for (int i = 0; i < 4; i++) {
    scanf("%s", mat[i]);
  }
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      if (mat[i][j] != '.') {
        array[counter] = mat[i][j];
        counter++;
      }
    }
  }
  int flag = 0, i;
  for (i = 0; i < counter; i++) {
    if (array[i] != -38) {
      flag = 1;
      for (int j = i + 1; j < counter; j++) {
        if (array[j] == array[i]) flag += 1;
      }
      if (flag > k) {
        printf("NO");
        exit(0);
      }
    }
  }
  if (i == counter) printf("YES");
  return 0;
}
