#include <bits/stdc++.h>
using namespace std;
using ul = unsigned long long int;
using ll = long long int;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int k;
  cin >> k;
  map<char, int> m;
  for (int i = 0; i < 16; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < s.length(); j++) {
      if (s[j] != '.') {
        if (m.find(s[j]) != m.end()) {
          m[s[j]] += 1;
        } else {
          m.insert(make_pair(s[j], 1));
        }
      }
    }
  }
  for (auto itr = m.begin(); itr != m.end(); itr++) {
    if (itr->second > 2 * k) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
