#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i = 0, j = 0, q = 0, w = 0, e = 0, r = 0, t = 0, y = 0, u = 0, o = 0,
         p = 0;
  cin >> n;
  string s;
  for (i = 1; i <= 4; i++) {
    cin >> s;
    for (j = 0; j < s.size(); j++) {
      if (s[j] == '.') continue;
      if (s[j] == '1') q++;
      if (s[j] == '2') w++;
      if (s[j] == '3') e++;
      if (s[j] == '4') r++;
      if (s[j] == '5') t++;
      if (s[j] == '6') y++;
      if (s[j] == '7') u++;
      if (s[j] == '8') o++;
      if (s[j] == '9') p++;
    }
  }
  if (q <= 2 * n && w <= 2 * n && e <= 2 * n && r <= 2 * n && t <= 2 * n &&
      y <= 2 * n && u <= 2 * n && o <= 2 * n && p <= 2 * n)
    cout << "YES";
  else
    cout << "NO";
}
