#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long a, b, c, d, e, f, g, h, m, n, t,
      flag = 0, co = 0, co1 = 0, arr1[10001], arr[200001] = {0}, sum = 0,
      sum1 = 0;
  string str, str1, str2;
  set<string> s;
  vector<long long> v;
  vector<long long> v1;
  vector<long long>::iterator it;
  cin >> n;
  for (int i = 0; i < 4; i++) {
    cin >> str;
    for (int i = 0; i < str.size(); i++) {
      if (str[i] == '.') continue;
      a = str[i] - '0';
      arr[a]++;
    }
  }
  for (int i = 1; i <= 9; i++) {
    if (arr[i] > (2 * n)) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
