#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k = 0;
  cin >> n;
  map<char, int> me;
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      char x;
      cin >> x;
      if (x != '.') {
        me[x]++;
        if (me[x] > k) k = me[x];
      }
    }
  }
  if (k > n * 2)
    cout << "NO";
  else
    cout << "YES";
}
