#include <bits/stdc++.h>
using namespace std;
int n;
char s[1005][1005];
void init() {
  for (int i = 0; i < 1000; i++)
    for (int j = 0; j < 1000; j++) s[i][j] = 'N';
  scanf("%d", &n);
}
void addEdge(int x, int y) { s[x][y] = s[y][x] = 'Y'; }
vector<int> v;
void process() {
  if (n == 1) {
    printf("2\nNY\nYN\n");
    return;
  }
  while (n != 1) {
    if (n % 2) v.push_back(1);
    v.push_back(2);
    n /= 2;
  }
  reverse(v.begin(), v.end());
  int c = 1, last = 0, len = 0;
  for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++) {
    if (*it == 1) {
      addEdge(0, c);
      for (int i = 1; i < len - 1; i++) addEdge(c, c + 1), c++;
      addEdge(c, last), c++;
    } else {
      addEdge(last, c);
      addEdge(last, c + 1);
      addEdge(c, c + 2);
      addEdge(c + 1, c + 2);
      last = c + 2;
      c += 3;
      len += 2;
    }
  }
  for (int i = 0; i < c; i++)
    if (i != 1 && i != last) {
      swap(s[1][i], s[last][i]);
      swap(s[i][1], s[i][last]);
    }
  printf("%d\n", c);
  for (int i = 0; i < c; i++) {
    s[i][c] = '\0';
    puts(s[i]);
  }
}
int main() {
  init();
  process();
  return 0;
}
