#include <bits/stdc++.h>   using namespace std;   bool isPrime(int N) {     for (int i = 2; i * i <= N; ++i) {       if (N % i == 0) return false;     }     return true;   }   bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {     return (a.first > b.first);   }   int gcd(int a, int b) {     if (b == 0) return a;     return gcd(b, a % b);   }   bool comp(const pair<int, int> &a, const pair<int, int> &b) {     if (a.first == b.first)       return a.second < b.second;     else       return a.first > b.first;   }   int main() {     int n;     cin >> n;     int flag = 0;     char a[5][5];     int max = 11;     int digit[11] = {0};     for (int i = 0; i < 4; i++) {       for (int j = 0; j < 4; j++) {         cin >> a[i][j];         if (a[i][j] !=  . ) {           digit[a[i][j] - 48]++;         }       }     }     for (int i = 0; i < 10; i++) {       if (digit[i] > 2 * n) {         cout <<  NO ;         flag = 1;         break;       }     }     if (flag == 0) {       cout <<  YES ;     }     return 0;   }   