#include <bits/stdc++.h>
using namespace std;
int maps[1001][1001];
int biao[101];
int cal(int x) {
  int len = 0;
  while (x > 0) {
    biao[len++] = x % 3;
    x /= 3;
  }
  return len;
}
int main() {
  int n, i, j, k;
  int ans;
  scanf("%d", &n);
  int st = 3;
  vector<int> vec;
  int lens = cal(n);
  for (i = 0; i < lens; i++) {
    if (biao[i]) {
      int tt;
      tt = 0;
      vec.clear();
      if (biao[i] == 1) {
        maps[1][st] = 1;
        vec.push_back(st);
        st++;
      } else {
        maps[1][st] = 1;
        vec.push_back(st);
        st++;
        maps[1][st] = 1;
        vec.push_back(st);
        st++;
      }
      for (j = 0; j <= i; j++) {
        for (k = 0; k < vec.size(); k++) {
          maps[vec[k]][st] = 1;
          maps[vec[k]][st + 1] = 1;
          maps[vec[k]][st + 2] = 1;
        }
        vec.clear();
        vec.push_back(st);
        vec.push_back(st + 1);
        vec.push_back(st + 2);
        st = st + 3;
      }
      st = st - 3;
      for (k = 1; k <= 1000; k++) {
        maps[k][st + 1] = 0;
        maps[k][st + 2] = 0;
      }
      for (; j < lens; j++) {
        maps[st][st + 1] = 1;
        st++;
      }
      maps[st][2] = 1;
      st++;
    }
  }
  st--;
  for (i = 1; i <= st; i++) {
    for (j = 1; j <= st; j++) {
      if (maps[i][j]) maps[j][i] = 1;
    }
  }
  cout << st << endl;
  for (i = 1; i <= st; i++) {
    for (j = 1; j <= st; j++) {
      if (maps[i][j])
        cout << "Y";
      else
        cout << "N";
    }
    cout << endl;
  }
  return 0;
}
