#include <bits/stdc++.h>
using namespace std;
bool pred(int n, int c, int pos[], int dist) {
  int cow = 1;
  int i = 1;
  int lastpos = pos[0];
  while (i < n) {
    if (pos[i] - lastpos >= dist) {
      cow++;
      lastpos = pos[i];
    }
    i++;
  }
  if (cow >= c)
    return true;
  else
    return false;
}
long long power(int x, int p) {
  if (p == 1)
    return x;
  else
    return x * power(x, p - 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  map<char, char> maps;
  vector<char> a;
  set<long long> st;
  int k, z = 0, y = 0;
  cin >> k;
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      char x;
      cin >> x;
      if (x != '.') {
        if (maps.find(x) != maps.end())
          maps[x]++;
        else
          maps[x] = 1;
        y++;
      }
    }
  }
  for (auto i : maps) {
    if (i.second > 2 * k) z++;
  }
  if (y == 0) {
    cout << "YES";
    return 0;
  }
  if (z)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
