#include <bits/stdc++.h>
using namespace std;
int some, point = 2, tmp, st, en = 1;
char ans[1005][1005];
int main() {
  for (register int i = 0; i <= 1000; i++) {
    for (register int j = 0; j <= 1000; j++) {
      ans[i][j] = 'N';
    }
  }
  scanf("%d", &some);
  for (register int i = 1; i <= some; i *= 2) {
    tmp = point;
    for (register int j = st; j < en; j++) {
      ans[j][point] = 'Y';
      ans[point][j] = 'Y';
      point++;
    }
    for (register int j = st; j < en; j++) {
      ans[j][point] = 'Y';
      ans[point][j] = 'Y';
    }
    point++;
    st = tmp;
    en = point;
  }
  for (register int i = st + 1; i < en; i++) {
    if (((1 << (i - st - 1)) & some) != 0) {
      ans[i][1] = 'Y';
      ans[1][i] = 'Y';
    }
  }
  printf("%d\n", point);
  for (register int i = 0; i < point; i++) {
    for (register int j = 0; j < point; j++) {
      printf("%c", ans[i][j]);
    }
    printf("\n");
  }
  return 0;
}
