#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 2, k, last_cnt = 0, cnt = 4, level = 6, last_level = 2,
      point_level = -1;
  cin >> k;
  vector<vector<bool>> a(100, vector<bool>(100, false));
  for (int i = int(2); i < int(6); i++) {
    a[i][0] = true;
    a[0][i] = true;
    last_cnt++;
    if (last_cnt == k) {
      for (int j = 2; j <= i; j++) {
        a[j][1] = true;
        a[1][j] = true;
      }
      cout << i + 1 << endl;
      for (int r = 0; r < int(i + 1); r++) {
        for (int t = 0; t < int(i + 1); t++) cout << (a[r][t] ? "Y" : "N");
        cout << endl;
      }
      return 0;
    }
  }
  while (true) {
    if (last_cnt + cnt <= k || (level - 2) % 4 == 0) {
      if ((level - 2) % 4 != 0) last_cnt += cnt;
      for (int i = last_level; i < last_level + 4; i++) {
        a[level][i] = true;
        a[i][level] = true;
      }
      level++;
    } else {
      point_level = level;
      level--;
      while ((level - 1) % 4 != 0) {
        a[level][1] = true;
        a[1][level] = true;
        level--;
      }
      a[point_level][1] = true;
      a[1][point_level] = true;
      level = point_level;
      cnt /= 4;
      while (true) {
        if (last_cnt == k) break;
        for (int i = last_level; i < last_level + 4; i++) {
          if (last_cnt + cnt <= k) {
            a[level][i] = true;
            a[i][level] = true;
            last_cnt += cnt;
          } else
            break;
        }
        cnt /= 4;
        last_level -= 4;
        a[level][level + 1] = true;
        a[level + 1][level] = true;
        level++;
      }
      break;
    }
    if ((level - 2) % 4 == 0) {
      cnt *= 4;
      last_level += 4;
    }
  }
  cout << level << endl;
  for (int r = 0; r < int(level); r++) {
    for (int t = 0; t < int(level); t++) cout << (a[r][t] ? "Y" : "N");
    cout << endl;
  }
}
