#include <bits/stdc++.h>
using namespace std;
void read_file(bool outToFile = true) {}
int conv(int x) {
  string s;
  stringstream ss;
  ss << x;
  ss >> s;
  for (int i = (int)s.length() - 1; i >= 0; i--)
    if (s[i] == '0') s.erase(i, 1);
  int ret;
  stringstream(s) >> ret;
  return ret;
}
int cnt[256 + 9];
int main() {
  read_file();
  int K;
  while (cin >> K) {
    memset(cnt, 0, sizeof cnt);
    char c;
    for (int i = 0; i < 4; i++)
      for (int j = 0; j < 4; j++) cin >> c, cnt[c]++;
    bool ok = true;
    for (int i = 0; i < 256; i++)
      if (cnt[i] > 2 * K && i != '.') ok = false;
    string ans = ok ? "YES" : "NO";
    cout << ans << '\n';
  }
}
