#[test]
fn check_solve() {
    assert_eq!(solve("2"), "-1\n");
    for &n in &[3,4,5,6,7,8,9,10,11,100,123,456,789,998,999,1000] {
        let out = solve(&n.to_string());
        let sw = out.split_whitespace();
        let brd: Vec<Vec<_>> = sw.map(|r| r.chars().collect()).collect();
        let mut q_pre = 0;
        for i in 0..n {
            let mut q = 0;
            let mut prev = '.';
            for j in 0..n {
                if brd[j][i] != '.' && brd[j][i] != prev {
                    q += 1;
                }
                prev = brd[j][i];
            }
            if i != 0 {
                assert_eq!(q, q_pre);
            }
            q_pre = q;
        }
        for i in 0..n {
            let mut q = 0;
            let mut prev = '.';
            for j in 0..n {
                if brd[i][j] != '.' && brd[i][j] != prev {
                    q += 1;
                }
                prev = brd[i][j];
            }
            assert_eq!(q, q_pre);
            q_pre = q;
        }
    }
}

fn solve(src: &str) -> String {
    let mut sc = Scanner::from_str(src);

    let p32 = vec![
        "aab",
        "b.b",
        "baa"
    ];
    let p43 = vec![
        "aaca",
        "bbca",
        "acbb",
        "acaa"
    ];
    let p53 = vec![
        "aabba",
        "bcc.a",
        "b..cb",
        "a..cb",
        "abbaa"
    ];
    let p73 = vec![
        ".aabbaa",
        "a..a..b",
        "a..a..b",
        "baa.bb.",
        "b..b..a",
        "a..b..a",
        "abb.aa.",
    ];

    let n: usize = sc.read();

    let mut brd = vec![vec!['.'; n + 1]; n];
    for i in 0..n {
        brd[i][n] = '\n';
    }
    if n == 2 {
        "-1\n".to_string()
    } else {
        match n {
            3 => put(&mut brd, 0, &p32),
            6 => {
                put(&mut brd, 0, &p32);
                put(&mut brd, 3, &p32);
            },
            7 => put(&mut brd, 0, &p73),
            11 => {
                put(&mut brd, 0, &p43);
                put(&mut brd, 4, &p73);
            },
            n => {
                let mut cnt = 0;
                while (n - cnt) % 4 != 0 {
                    put(&mut brd, cnt, &p53);
                    cnt += 5;
                }
                while cnt < n {
                    put(&mut brd, cnt, &p43);
                    cnt += 4;
                }
            }
        }
        brd.iter().flat_map(|v| v.clone().into_iter()).collect()
    }
}

fn put(brd: &mut [Vec<char>], pos: usize, pat: &[&str]) {
    for (i, row) in pat.iter().enumerate() {
        for (j, c) in row.chars().enumerate() {
            brd[pos+i][pos+j] = c;
        }
    }
}

fn main() {
    let mut buf = String::new();
    use std::io;
    use std::io::{Read, Write};
    io::stdin().read_to_string(&mut buf).unwrap();
    io::stdout().write_all(solve(&buf).as_bytes()).unwrap();
}

struct Scanner<'a>(std::str::SplitWhitespace<'a>);
impl<'a> Scanner<'a> {
    fn from_str(src: &str) -> Scanner {
        Scanner(src.split_whitespace())
    }
    fn get(&mut self) -> &str {
        self.0.next().unwrap()
    }
    fn read<T: std::str::FromStr>(&mut self) -> T {
        self.get().parse().ok().unwrap()
    }
}


Measured memory_bytes: 8444