#include <bits/stdc++.h>
const long long linf = (long long)1e9 + 7;
const long long N = (long long)1e5 + 7;
const long long mod = (long long)998244353;
const int P = 53;
using namespace std;
int h[N];
int deg[N];
void calchs(string d) {
  deg[0] = 1;
  h[0] = d[0];
  for (int i = 1; i < d.size(); i++) {
    deg[i] = deg[i - 1] * P;
    h[i] = (d[i] - 'a' + 1) * deg[i] + h[i - 1];
  }
}
long long get_hash(int l, int r) {
  if (l == 0)
    return h[r];
  else
    return h[r] - h[l - 1];
}
int a[300][300];
map<int, int> mp;
int main() {
  ios_base::sync_with_stdio();
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  set<int> s;
  for (int i = 1; i <= 4; i++) {
    string d;
    cin >> d;
    for (int j = 0; j < d.size(); j++) {
      if (d[j] != '.') {
        s.insert(int(d[j] - '0'));
        mp[int(d[j] - '0')]++;
      }
    }
  }
  for (auto to : s) {
    if (mp[to] > n * 2) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
