#include <bits/stdc++.h>
using namespace std;
struct __timestamper {};
char s[1010][1010];
int n;
void addedge(int u, int v) {
  assert(u != v);
  assert(s[u][v] != 'Y');
  s[u][v] = s[v][u] = 'Y';
}
int solve(int f, int t, int k) {
  for (int i = 2; i * i <= k; i++)
    if (k % i == 0) {
      int ne = n++;
      assert(n <= 1000);
      int tmp = solve(f, ne, i);
      tmp += solve(ne, t, k / i);
      return tmp;
    }
  if (k == 1) {
    int ne = n++;
    addedge(f, ne);
    addedge(ne, t);
    return 2;
  }
  int tmp = solve(f, t, k - 1);
  for (int i = 0; i < tmp; i++) {
    int nf = (i == tmp - 1 ? t : n++);
    addedge(f, nf);
    f = nf;
  }
  return tmp;
}
int main() {
  int k;
  scanf("%d", &k);
  n = 2;
  memset(s, 'N', sizeof(s));
  solve(0, 1, k);
  printf("%d\n", n);
  for (int i = 0; i < n; i++) s[i][n] = 0, puts(s[i]);
  return 0;
}
