#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
int k, n, ak[100], ak0;
bool mp[maxn][maxn];
int p[maxn];
int main() {
  scanf("%d", &k);
  if (k == 1) {
    printf("2\nNY\nYN\n");
    return 0;
  }
  for (; k; k >>= 1) ak[++ak0] = (k & 1);
  n = 1;
  int now = 1, len = 0;
  for (int i = ak0 - 1; i >= 1; i--) {
    len += 2;
    mp[n + 1][now] = mp[now][n + 1] = 1;
    mp[n + 2][now] = mp[now][n + 2] = 1;
    n += 3;
    mp[n - 2][n] = mp[n][n - 2] = 1;
    mp[n - 1][n] = mp[n][n - 1] = 1;
    now = n;
    if (ak[i]) {
      int last = 1;
      for (int j = 1; j <= len - 1; j++) {
        n++;
        mp[last][n] = mp[n][last] = 1;
        last = n;
      }
      mp[last][now] = mp[now][last] = 1;
    }
  }
  for (int i = 1; i <= n; i++) p[i] = i;
  p[2] = now, p[now] = 2;
  printf("%d\n", n);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) putchar(mp[p[i]][p[j]] ? 'Y' : 'N');
    putchar('\n');
  }
}
