#include <bits/stdc++.h>
using namespace std;
void desperate_optimization(int precision) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.setf(ios::showpoint);
  cout.precision(precision);
}
int flow[2005][2005];
long long n;
stack<long long> re;
int main() {
  desperate_optimization(10);
  cin >> n;
  long long lo = 1;
  long long maxi = 0;
  while (lo <= n) {
    lo *= 3LL;
    maxi++;
  }
  maxi--;
  long long tmp = n;
  while (tmp) {
    re.push(tmp % 3);
    tmp /= 3;
  }
  lo = 1;
  long long hi = 2;
  vector<long long> last;
  for (int i = maxi; i >= 0; i--) {
    long long tr = re.top();
    re.pop();
    if (tr == 0) continue;
    long long now = lo;
    for (int j = 0; j < i; j++) {
      hi++;
      flow[now][hi] = flow[hi][now] = 1;
      hi++;
      flow[now][hi] = flow[hi][now] = 1;
      hi++;
      flow[now][hi] = flow[hi][now] = 1;
      hi++;
      flow[hi - 1][hi] = flow[hi][hi - 1] = 1;
      flow[hi - 2][hi] = flow[hi][hi - 2] = 1;
      flow[hi - 3][hi] = flow[hi][hi - 3] = 1;
      now = hi;
    }
    for (int j = i; j < maxi; j++) {
      hi++;
      flow[now][hi] = flow[hi][now] = 1;
      now = hi;
      hi++;
      flow[now][hi] = flow[hi][now] = 1;
      now = hi;
    }
    if (tr == 2) {
      hi++;
      flow[now][hi] = flow[hi][now] = 1;
      hi++;
      flow[now][hi] = flow[hi][now] = 1;
      hi++;
      flow[hi - 2][hi] = flow[hi][hi - 2] = 1;
      flow[hi - 1][hi] = flow[hi][hi - 1] = 1;
    } else {
      hi++;
      flow[now][hi] = flow[hi][now] = 1;
      now = hi;
      hi++;
      flow[now][hi] = flow[hi][now] = 1;
    }
    last.push_back(hi);
  }
  for (int i = 0; i < last.size(); i++) {
    int nx = last[i];
    flow[nx][2] = flow[2][nx] = 1;
  }
  cout << hi << '\n';
  for (int i = 1; i <= hi; i++) {
    for (int j = 1; j <= hi; j++) cout << ((flow[i][j] == 1) ? 'Y' : 'N');
    cout << '\n';
  }
  return 0;
}
