#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e, j, t, i, l, n, m;
  cin >> n;
  int ar[150] = {0};
  char arr[4][4];
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 4; j++) {
      cin >> arr[i][j];
      ar[arr[i][j]]++;
    }
  }
  for (i = 48; i < 150; i++) {
    if (ar[i] > 2 * n) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
