#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  int a[10] = {0};
  for (int i = 0; i < 4; i++) {
    cin >> s;
    int j = 0;
    while (s[j] != '\0') {
      if (s[j] != '.') a[s[j] - 48]++;
      j++;
    }
  }
  int f = 0;
  for (int i = 0; i < 10; i++) {
    if (a[i] > 2 * n) {
      f = 1;
      break;
    }
  }
  if (f == 1)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
