#include <bits/stdc++.h>
using namespace std;
int maps[107][107];
void addEdge(int a, int b) { maps[a][b] = maps[b][a] = 1; }
int main() {
  int n, size = 0, t;
  scanf("%d", &n);
  t = --n;
  while (t) {
    ++size;
    t >>= 1;
  }
  if (!size) {
    printf("2\nNY\nYN\n");
    return 0;
  }
  addEdge(1, 3);
  addEdge(1, 4);
  addEdge(1, 5);
  addEdge(size * 3, 2);
  for (int i = 1; i < size; ++i) {
    addEdge(i * 3, (i + 1) * 3);
    addEdge(i * 3 + 1, (i + 1) * 3 + 1);
    addEdge(i * 3 + 2, (i + 1) * 3 + 2);
    addEdge(i * 3 + 1, (i + 1) * 3 + 2);
    addEdge(i * 3 + 2, (i + 1) * 3 + 1);
  }
  int now = 0;
  while (n) {
    ++now;
    if (n & 1) {
      if (now == size)
        addEdge(2, 3 * now + 1);
      else
        addEdge(3 * (now + 1), 3 * now + 1);
    }
    n >>= 1;
  }
  size = size * 3 + 2;
  printf("%d\n", size);
  for (int i = 1; i <= size; ++i) {
    for (int j = 1; j <= size; ++j) printf("%c", maps[i][j] ? 'Y' : 'N');
    printf("\n");
  }
  return 0;
}
