Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You should calculate the number of shortest paths between vertex 1 and vertex 2."

Same with some writers, she wants to make an example with some certain output: for example, her birthday or the number of her boyfriend. Can you help her to make a test case with answer equal exactly to k?

Input

The first line contains a single integer k (1 ≤ k ≤ 109).

Output

You should output a graph G with n vertexes (2 ≤ n ≤ 1000). There must be exactly k shortest paths between vertex 1 and vertex 2 of the graph.

The first line must contain an integer n. Then adjacency matrix G with n rows and n columns must follow. Each element of the matrix must be 'N' or 'Y'. If Gij is 'Y', then graph G has a edge connecting vertex i and vertex j. Consider the graph vertexes are numbered from 1 to n.

The graph must be undirected and simple: Gii = 'N' and Gij = Gji must hold. And there must be at least one path between vertex 1 and vertex 2. It's guaranteed that the answer exists. If there multiple correct answers, you can output any of them. 

Examples

Input

2

Output

4
NNYY
NNYY
YYNN
YYNN

Input

9

Output

8
NNYYYNNN
NNNNNYYY
YNNNNYYY
YNNNNYYY
YNNNNYYY
NYYYYNNN
NYYYYNNN
NYYYYNNN

Input

1

Output

2
NY
YN

Note

In first example, there are 2 shortest paths: 1-3-2 and 1-4-2.

In second example, there are 9 shortest paths: 1-3-6-2, 1-3-7-2, 1-3-8-2, 1-4-6-2, 1-4-7-2, 1-4-8-2, 1-5-6-2, 1-5-7-2, 1-5-8-2.
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.InputMismatchException;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.TreeSet;
import java.io.Reader;
import java.io.Writer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Nipuna Samarasekara
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		FastPrinter out = new FastPrinter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    /////////////////////////////////////////////////////////////

    public void solve(int testNumber, FastScanner in, FastPrinter out) {
    long n=in.nextInt();
    int[] pow= new int[32];
    int pos=0;
        while(n>0){
            pow[pos]=(int)(n%3);
            n/=3;
            pos++;

        }
       int len=pos+1;
      char[][] ans= new char[1000][1000];
        for (int i = 0; i < 1000; i++) {
            for (int j = 0; j < 1000; j++) {
                ans[i][j]='N';
            }
        }
        int cv=2;
        int tl;
        TreeSet<Integer> prev = new TreeSet<Integer>();
        TreeSet<Integer> cur = new TreeSet<Integer>();

        for (int i = pos; i >=0 ; i--) {
            if(pow[i]==0)continue;
           prev.clear();
            cur.clear();
           prev.add(0);
            tl=0;
            int ones=pos-1-i;
            while(ones>0){
                ones--;
                ans[prev.first()][cv]='Y';
                ans[cv][prev.first()]='Y';
                prev.clear();
                prev.add(cv);
                tl++;
                cv++;
            }
            for (int j = 0; j < pow[i]; j++) {
               cur.add(cv);cv++;
            }
            for (Integer integer : prev) {
                for (Integer integer1 : cur) {
                    ans[integer][integer1]='Y';
                    ans[integer1][integer]='Y';
                }
            }
            prev= (TreeSet<Integer>) cur.clone();
            cur.clear();
            tl++;
            for (int k = 0; k < i; k++) {
                tl++;
                for (int j = 0; j < 3; j++) {
                    cur.add(cv);cv++;
                }
                for (Integer integer : prev) {
                    for (Integer integer1 : cur) {
                        ans[integer][integer1]='Y';
                        ans[integer1][integer]='Y';
                    }
                }
                prev= (TreeSet<Integer>) cur.clone();
                cur.clear();
            }
            cur.add(1);
            for (Integer integer : prev) {
                for (Integer integer1 : cur) {
                    ans[integer][integer1]='Y';
                    ans[integer1][integer]='Y';
                }
            }
            tl++;

        }
        out.println(cv);
        for (int i = 0; i < cv; i++) {
            for (int j = 0; j < cv; j++) {
                out.print(ans[i][j]);
            }
            out.println();
        }
    }
}

class FastScanner extends BufferedReader {

    public FastScanner(InputStream is) {
        super(new InputStreamReader(is));
    }

    public int read() {
        try {
            int ret = super.read();
//            if (isEOF && ret < 0) {
//                throw new InputMismatchException();
//            }
//            isEOF = ret == -1;
            return ret;
        } catch (IOException e) {
            throw new InputMismatchException();
        }
    }

    static boolean isWhiteSpace(int c) {
        return c >= 0 && c <= 32;
    }

    public int nextInt() {
        int c = read();
        while (isWhiteSpace(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int ret = 0;
        while (c >= 0 && !isWhiteSpace(c)) {
            if (c < '0' || c > '9') {
                throw new NumberFormatException("digit expected " + (char) c
                        + " found");
            }
            ret = ret * 10 + c - '0';
            c = read();
        }
        return ret * sgn;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }

    }

class FastPrinter extends PrintWriter {

    public FastPrinter(OutputStream out) {
        super(out);
    }

    public FastPrinter(Writer out) {
        super(out);
    }


}

