package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var n int
	if _, err := fmt.Scanf("%d\n", &n); err != nil {
		return
	}

	array := make([]int, n)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 0; scanner.Scan(); i++ {
		a, err := strconv.Atoi(scanner.Text())
		if err != nil {
			return
		}
		array[i] = a
	}

	var tail_value int = 0
	for i := n - 1; i >= 0; i-- {
		if i%2 == 0 {
			array[i] -= tail_value
			tail_value += array[i]
		} else {
			array[i] += tail_value
			tail_value -= array[i]
		}
	}

	for i := 0; i < n; i++ {
		fmt.Printf("%d ", array[i])
	}
	fmt.Println()
}

// cf712a project main.go
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner *bufio.Scanner = bufio.NewScanner(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func ReadInt32() int {
	scanner.Scan()
	ans, _ := strconv.Atoi(scanner.Text())
	return ans
}
func PrintInts(ints []int) {
	for _, value := range ints {
		writer.WriteString(strconv.Itoa(value))
		writer.WriteByte(' ')
	}
}
func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)
	var n int
	var m []int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		m = append(m, ReadInt32())
	}
	b := make([]int, n)
	for i := n - 1; i >= 0; i-- {
		if i == n-1 {
			b[i] = m[i]
		} else {
			b[i] = m[i] + m[i+1]
		}

	}
	PrintInts(b)

}

package main

import "fmt"
import "bufio"
import "os"

func main() {
	buf := bufio.NewReader(os.Stdin)

	var n int
	fmt.Fscanf(buf, "%d\n", &n)

	a := make([]int, n+1)
	for i := 1; i <= n; i++ {
		fmt.Fscanf(buf, "%d\n", &a[i])
	}

	for i := 1; i < n; i++ {
		b := a[i] + a[i+1]
		fmt.Printf("%d ", b)
	}
	fmt.Printf("%d\n", a[n])
}

// http://codeforces.com/contest/712/problem/A
package main

import (
	"fmt"
	"bufio"
	"os"
)

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)

func main () {
	var n int

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)

	fmt.Fscanln(input, &n)
	mass := make([]int, n)
	ans := make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Fscan(input, &mass[i])
	}

	ans[n - 1] = mass[n - 1]
	for i := n - 2; i >= 0; i-- {
		ans[i] = mass[i] + mass[i + 1]
	}

	for i := 0; i < n; i++ {
		fmt.Print(ans[i], " ")
	}
}

// http://codeforces.com/contest/712/problem/A
package main

import (
	"fmt"
	"bufio"
	"os"
)

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)

func main () {
	var n int

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)

	fmt.Fscanln(input, &n)
	mass := make([]int, n)
	ans := make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Fscan(input, &mass[i])
	}

	ans[n - 1] = mass[n - 1]
	for i := n - 2; i >= 0; i-- {
		ans[i] = mass[i] + mass[i + 1]
	}

	for i := 0; i < n; i++ {
		if i == n - 1 {
			fmt.Print(ans[i])
		} else {
			fmt.Print(ans[i], " ")
		}
	}
}

package main

import "fmt"
import "os"
import "bufio"
import "strconv"
import "bytes"

func main() {
    var n int
    fmt.Scan(&n)

    nums := make([]int, n)
    results := make([]int, n)
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)

    for i:=0; scanner.Scan(); i++ {
        nums[i], _ = strconv.Atoi(scanner.Text())
    }

    results[n-1] = nums[n-1]
    for i:=n-2; i >= 0; i-- {
        results[i] = nums[i] + nums[i+1]
    }

    var buf bytes.Buffer

    for i:=0; i < n; i++ {
        buf.WriteString(strconv.Itoa(results[i]) + " ")
    }
    fmt.Print(buf.String())

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	text = strings.TrimRight(text, "\r\n")
	s := strings.Split(text, " ")

	c, _ := strconv.Atoi(s[0])
	//x, _ := strconv.ParseInt(s[1], 10, 64)
	text, _ = reader.ReadString('\n')
	text = strings.TrimRight(text, "\r\n")
	s = strings.Split(text, " ")
	ans := make([]int64, c)
	v1 := int64(0)
	v2 := int64(0)
	for i := c - 1; i >= 0; i-- {
		v, _ := strconv.ParseInt(s[i], 10, 64)

		if i%2 == 0 {
			ans[i] = v - v1
			v1 += ans[i]
			v2 -= ans[i]

		} else {
			ans[i] = v - v2
			v1 -= ans[i]
			v2 += ans[i]

		}
	}
	for _, v := range ans {
		fmt.Printf("%d ", v)
	}
	fmt.Println()

}

// http://codeforces.com/contest/712/problem/A
package main

import (
	"fmt"
	"bufio"
	"os"
)

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)

func main () {
	var n int

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)

	fmt.Fscanln(input, &n)

	mass := make([]int, n)
	ans := make([]int, n)
	for i := 0; i < n; i++ {
		var tmp int
		fmt.Scan(&tmp)
		mass[i] = tmp
	}

	ans[n - 1] = mass[n - 1]
	for i := n - 2; i >= 0; i-- {
		ans[i] = mass[i] + mass[i + 1]
	}

	for i := 0; i < n; i++ {
		if i == n - 1 {
			fmt.Print(ans[i])
		} else {
			fmt.Print(ans[i], " ")
		}
	}
}

// http://codeforces.com/contest/712/problem/A
package main

import (
	"fmt"
	"bufio"
	"os"
)

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)

func main () {
	var n int

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)

	fmt.Fscanln(input, &n)

	mass := make([]int, n)
	ans := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&mass[i])
	}

	ans[n - 1] = mass[n - 1]
	for i := n - 2; i >= 0; i-- {
		ans[i] = mass[i] + mass[i + 1]
	}

	for i := 0; i < n; i++ {
		if i == n - 1 {
			fmt.Print(ans[i])
		} else {
			fmt.Print(ans[i], " ")
		}
	}
}

// http://codeforces.com/contest/712/problem/A
package main

import (
	"fmt"
	"bufio"
	"os"
)

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)

func main () {
	var n int

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)

	fmt.Fscanln(input, &n)

	mass := make([]int, n)
	ans := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&mass[i])
	}

	ans[n - 1] = mass[n - 1]
	for i := n - 2; i >= 0; i-- {
		ans[i] = mass[i] + mass[i + 1]
	}

	for i := 0; i < n; i++ {
		fmt.Print(ans[i], " ")
	}
}

package main

import "fmt"

func main() {
	var n int
	if _, err := fmt.Scanf("%d", &n); err != nil {
		return
	}

	array := make([]int, n)
	for i := 0; i < n; i++ {
		if _, err := fmt.Scanf("%d", &array[i]); err != nil {
			return
		}
	}

	var tail_value int = 0
	for i := n - 1; i >= 0; i-- {
		if i%2 == 0 {
			array[i] -= tail_value
			tail_value += array[i]
		} else {
			array[i] += tail_value
			tail_value -= array[i]
		}
	}

	for i := 0; i < n; i++ {
		fmt.Printf("%d ", array[i])
	}
	fmt.Println()
}

package main

import "fmt"
import "os"
import "bufio"
import "strconv"

func main() {
    var n int
    fmt.Scan(&n)

    nums := make([]int, n)
    results := make([]int, n)
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)

    for i:=0; scanner.Scan(); i++ {
        nums[i], _ = strconv.Atoi(scanner.Text())
    }

    results[n-1] = nums[n-1]
    for i:=n-2; i >= 0; i-- {
        results[i] = nums[i] + results[i+1]
    }

    resStr := ""
    for i:=0; i < n; i++ {
        resStr += strconv.Itoa(results[i]) + " "
    }
    fmt.Print(resStr)

}

// cf712a project main.go
package main

import (
	"fmt"
)

type A []int

func main() {
	var n int
	var m A
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		m = append(m, a)
	}
	m = reverse(m)
	fmt.Println(m)
	var b A

	for i, a := range m {
		if i == 0 {
			b = append(b, a)
		} else {
			l := a
			flag := i%2 != 0
			for j := 0; j < i; j++ {
				if flag {
					l += b[j]
				} else {
					l -= b[j]
				}
				flag = !flag
			}
			b = append(b, l)
		}
	}
	b = reverse(b)
	o := fmt.Sprint(b)
	fmt.Println(o[1 : len(o)-1])
}
func reverse(a []int) []int {
	for i, j := 0, len(a)-1; i < len(a)/2; i, j = i+1, j-1 {
		a[i], a[j] = a[j], a[i]
	}
	return a
}


package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func Problem1569B(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	t := 0
	fmt.Fscanln(in, &t)
	for tcNo := 1; tcNo <= t; tcNo++ {
		numberOfPlayers := 0
		fmt.Fscanln(in, &numberOfPlayers)

		playerTypes := ""
		fmt.Fscanln(in, &playerTypes)

		impossible := false
		tournament := make([][]rune, numberOfPlayers)
		for i := 0; i < numberOfPlayers; i++ {
			tournament[i] = make([]rune, numberOfPlayers)
			tournament[i][i] = 'X'
		}
		queue := make([][]int, 0)
		queue = append(queue, []int{0, 0})
		for len(queue) > 0 {
			reset := false
			start := queue[len(queue)-1]
			queue = queue[:len(queue)-1]
			for i := start[0]; i < numberOfPlayers; i++ {
				winCount := 0
				for j := i + 1; j < numberOfPlayers; j++ {
					if i == start[0] && j < start[1] {
						if tournament[i][j] == '+' {
							winCount++
						}
						continue
					}
					if playerTypes[i] == '1' || playerTypes[j] == '1' {
						tournament[i][j] = '='
						tournament[j][i] = '='
					} else if playerTypes[i] == '2' {
						if winCount > 0 || (i == start[0] && j == start[1]) {
							tournament[i][j] = '-'
							tournament[j][i] = '+'
						} else {
							queue = append(queue, []int{i, j})
							tournament[i][j] = '+'
							tournament[j][i] = '-'
							winCount++
						}
					}
				}
				winCount = 0
				loseCount := 0
				for j := 0; j < numberOfPlayers; j++ {
					switch tournament[i][j] {
					case '+':
						winCount++
					case '-':
						loseCount++
					}
				}
				acceptable := (playerTypes[i] == '1' && loseCount == 0) ||
					(playerTypes[i] != '1' && winCount > 0)
				if !acceptable {
					reset = true
					break
				}
			}
			if !reset {
				break
			} else if reset && len(queue) == 0 {
				impossible = true
				break
			}
		}
		if impossible {
			fmt.Fprintln(out, "NO")
		} else {
			fmt.Fprintln(out, "YES")
			for i := 0; i < numberOfPlayers; i++ {
				fmt.Fprintln(out, string(tournament[i]))
			}
		}
	}
}

func main() {
	Problem1569B(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }

func main() {
	var t int
	scanf("%d\n", &t)
	s := make([]byte, 53)
	for ; t > 0; t-- {
		var n int
		scanf("%d\n", &n)
		scanf("%s\n", &s)
		cnt1 := 0
		cnt2 := 0
		prev2 := make([]int, n)
		first2 := -1
		last2 := -1
		for i, c := range s {
			if c == '1' {
				cnt1++
			} else if c == '2' {
				cnt2++
				if first2 == -1 {
					first2 = i
				} else {
					prev2[i] = last2
				}
				last2 = i
			}
		}
		if first2 != -1 {
			prev2[first2] = last2
		}
		if cnt2 == 1 || cnt2 == 2 {
			printf("NO\n")
		} else {
			printf("YES\n")
			u := make([]byte, n)
			for i, c := range s {
				for j, d := range s {
					if i == j {
						u[j] = 'X'
					} else if c == '1' || d == '1' {
						u[j] = '='
					} else {
						if j == prev2[i] {
							u[j] = '+'
						} else if i == prev2[j] {
							u[j] = '-'
						} else {
							u[j] = '='
						}
					}
				}
				printf("%s\n", string(u))
			}
		}
	}
	writer.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

func MINN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func MAXX(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	if x*y == 0 {
		return MAX(x, y)
	} else {
		var l, q int64
		l = MAX(x, y)
		q = MIN(x, y)
		var m int64
		for l*q > 0 {
			a := l % q
			b := l - a
			cc := int64(b / q)
			remain := l - cc*q
			l = MAX(remain, q)
			q = MIN(remain, q)
			if l*q == 0 {
				m = l + q
				break
			}

		}
		return m
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

func BITAND(x, y int64) int64 {
	var ans int64
	begin := x
	sec := y
	var count int64 = 1
	for 1 == 1 {
		if (begin%2)*(sec%2) == 1 {
			ans = ans + count
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}

		} else {
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}
		}
	}
	return ans
}

func Sum(n, m int) int {
	var ans int

	if n == 1 {
		return 0
	} else {
		for i := 2; i < n; i++ {
			ans = (ans + Sum(i, m)) % m
		}
		for j := 2; j < n+1; j++ {
			ans = (ans + Sum(n/j, m)) % m
		}
		return ans
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {
		var n int
		fmt.Fscan(input, &n)

		STRING := make([]byte, 0)
		fmt.Fscan(input, &STRING)
		ARRAY := make([]int, 0)
		ANS := make([][]byte, n)
		for i := 0; i < n; i++ {
			if string(STRING[i]) == "2" {
				ARRAY = append(ARRAY, i)
			}
		}

		q := len(ARRAY)
		if q == 1 || q == 2 {
			fmt.Println("NO")
		} else {
			for i := 0; i < n; i++ {
				for j := 0; j < n; j++ {
					if i == j {
						ANS[i] = append(ANS[i], 88)
					} else {
						ANS[i] = append(ANS[i], 61)
					}

				}
			}

			if q > 2 {
				for i := 0; i < q-1; i++ {
					ANS[ARRAY[i]][ARRAY[i+1]] = 43
					ANS[ARRAY[i+1]][ARRAY[i]] = 45
				}
				ANS[ARRAY[q-1]][ARRAY[0]] = 43
				ANS[ARRAY[0]][ARRAY[q-1]] = 45

			}
			fmt.Println("YES")
			for i := 0; i < n; i++ {
				fmt.Println(string(ANS[i]))
			}

		}

	}
}

// https://codeforces.com/problemset/problem/1569/B

package main

import (
	"bufio"
	"fmt"
	"os"
)

// A chess tournament will be held soon, where n chess players will take part. Every participant will play one game against every other participant. Each game ends in either a win for one player and a loss for another player, or a draw for both players.
// Each of the players has their own expectations about the tournament, they can be one of two types:
// 1. a player wants not to lose any game (i. e. finish the tournament with zero losses);
// 2. a player wants to win at least one game.
// You have to determine if there exists an outcome for all the matches such that all the players meet their expectations. If there are several possible outcomes, print any of them. If there are none, report that it's impossible.

// Input
// The first line contains a single integer t (1≤t≤200) — the number of test cases.
// The first line of each test case contains one integer n (2≤n≤50) — the number of chess players.
// The second line contains the string s (|s|=n; si∈{1,2}). If si=1, then the i-th player has expectations of the first type, otherwise of the second type.

// Output
// For each test case, print the answer in the following format:
// In the first line, print NO if it is impossible to meet the expectations of all players.
// Otherwise, print YES, and the matrix of size n×n in the next n lines.
// The matrix element in the i-th row and j-th column should be equal to:
// +, if the i-th player won in a game against the j-th player;
// -, if the i-th player lost in a game against the j-th player;
// =, if the i-th and j-th players' game resulted in a draw;
// X, if i=j.

func main() {
	var reader = bufio.NewReader(os.Stdin)
	var t, n, i, j, k, x, y int
	var s string
	var v []int
	var matrix [][]byte

	for fmt.Fscan(reader, &t); t > 0; t-- {
		fmt.Fscan(reader, &n)
		fmt.Fscan(reader, &s)
		v = make([]int, 0, n)

		for i = 0; i < n; i++ {
			if s[i] == '2' {
				v = append(v, i)
			}
		}

		k = len(v)

		if k == 1 || k == 2 {
			fmt.Println("NO")
		} else {
			matrix = make([][]byte, n)

			for i = 0; i < n; i++ {
				matrix[i] = make([]byte, n)

				for j = 0; j < n; j++ {
					matrix[i][j] = '='
				}

				matrix[i][i] = 'X'
			}

			for i = 0; i < len(v); i++ {
				x = v[i]
				y = v[(i+1)%k]
				matrix[x][y] = '+'
				matrix[y][x] = '-'
			}

			fmt.Println("YES")

			for _, row := range matrix {
				fmt.Println(string(row))
			}
		}
	}
}

// https://codeforces.com/problemset/problem/1569/B

package main

import "fmt"

// A chess tournament will be held soon, where n chess players will take part. Every participant will play one game against every other participant. Each game ends in either a win for one player and a loss for another player, or a draw for both players.
// Each of the players has their own expectations about the tournament, they can be one of two types:
// 1. a player wants not to lose any game (i. e. finish the tournament with zero losses);
// 2. a player wants to win at least one game.
// You have to determine if there exists an outcome for all the matches such that all the players meet their expectations. If there are several possible outcomes, print any of them. If there are none, report that it's impossible.

// Input
// The first line contains a single integer t (1≤t≤200) — the number of test cases.
// The first line of each test case contains one integer n (2≤n≤50) — the number of chess players.
// The second line contains the string s (|s|=n; si∈{1,2}). If si=1, then the i-th player has expectations of the first type, otherwise of the second type.

// Output
// For each test case, print the answer in the following format:
// In the first line, print NO if it is impossible to meet the expectations of all players.
// Otherwise, print YES, and the matrix of size n×n in the next n lines.
// The matrix element in the i-th row and j-th column should be equal to:
// +, if the i-th player won in a game against the j-th player;
// -, if the i-th player lost in a game against the j-th player;
// =, if the i-th and j-th players' game resulted in a draw;
// X, if i=j.

func main() {
	var t, n, i, j, k, x, y int
	var s string
	var v []int
	var matrix [][]byte

	for fmt.Scan(&t); t > 0; t-- {
		fmt.Scan(&n, &s)
		v = make([]int, 0, n)

		for i = 0; i < n; i++ {
			if s[i] == '2' {
				v = append(v, i)
			}
		}

		k = len(v)

		if k == 1 || k == 2 {
			fmt.Println("NO")
		} else {
			matrix = make([][]byte, n)

			for i = 0; i < n; i++ {
				matrix[i] = make([]byte, n)

				for j = 0; j < n; j++ {
					matrix[i][j] = '='
				}

				matrix[i][i] = 'X'
			}

			for i = 0; i < len(v); i++ {
				x = v[i]
				y = v[(i+1)%k]
				matrix[x][y] = '+'
				matrix[y][x] = '-'
			}

			fmt.Println("YES")

			for _, row := range matrix {
				fmt.Println(string(row))
			}
		}
	}
}

// https://codeforces.com/problemset/problem/1569/B

package main

import "fmt"

// A chess tournament will be held soon, where n chess players will take part. Every participant will play one game against every other participant. Each game ends in either a win for one player and a loss for another player, or a draw for both players.
// Each of the players has their own expectations about the tournament, they can be one of two types:
// 1. a player wants not to lose any game (i. e. finish the tournament with zero losses);
// 2. a player wants to win at least one game.
// You have to determine if there exists an outcome for all the matches such that all the players meet their expectations. If there are several possible outcomes, print any of them. If there are none, report that it's impossible.

// Input
// The first line contains a single integer t (1≤t≤200) — the number of test cases.
// The first line of each test case contains one integer n (2≤n≤50) — the number of chess players.
// The second line contains the string s (|s|=n; si∈{1,2}). If si=1, then the i-th player has expectations of the first type, otherwise of the second type.

// Output
// For each test case, print the answer in the following format:
// In the first line, print NO if it is impossible to meet the expectations of all players.
// Otherwise, print YES, and the matrix of size n×n in the next n lines.
// The matrix element in the i-th row and j-th column should be equal to:
// +, if the i-th player won in a game against the j-th player;
// -, if the i-th player lost in a game against the j-th player;
// =, if the i-th and j-th players' game resulted in a draw;
// X, if i=j.

func main() {
	var t, n, i, j, k, x, y int
	var s string
	var v []int
	var matrix [][]rune

	for fmt.Scan(&t); t > 0; t-- {
		fmt.Scan(&n, &s)
		v = make([]int, 0, n)

		for i = 0; i < n; i++ {
			if s[i] == '2' {
				v = append(v, i)
			}
		}

		k = len(v)

		// fmt.Printf("k = %d\n", k)

		if k == 1 || k == 2 {
			fmt.Println("NO")
		} else {
			matrix = make([][]rune, n)

			for i = 0; i < n; i++ {
				matrix[i] = make([]rune, n)

				for j = 0; j < n; j++ {
					matrix[i][j] = '='
				}

				matrix[i][i] = 'X'
			}

			for i = 0; i < len(v); i++ {
				x = v[i]
				y = v[(i+1)%k]
				// fmt.Printf("x = %d, y = %d\n", x, y)
				matrix[x][y] = '+'
				matrix[y][x] = '-'
			}

			fmt.Println("YES")

			for i = 0; i < n; i++ {
				for j = 0; j < n; j++ {
					fmt.Printf("%c", matrix[i][j])
				}

				fmt.Println()
			}
		}
	}
}

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		var s string
		fmt.Fscan(reader, &n, &s)
		a := make([][]int, n)
		for i := 0; i < n; i++ {
			a[i] = make([]int, n)
		}
		winners := make([]int, 0)
		for i := 0; i < n; i++ {
			if s[i] == '2' {
				winners = append(winners, i)
			}
		}
		if len(winners) == 1 || len(winners) == 2 {
			write(f, "NO\n")
		} else {
			write(f, "YES\n")
			for i := 0; i < len(winners); i++ {
				j, k := winners[i], winners[(i+1)%len(winners)]
				a[j][k] = 1
				a[k][j] = -1
			}
			for i := 0; i < n; i++ {
				for j := 0; j < n; j++ {
					if i == j {
						write(f, "X")
					} else if a[i][j] == 0 {
						write(f, "=")
					} else if a[i][j] == 1 {
						write(f, "+")
					} else {
						write(f, "-")
					}
				}
				write(f, "\n")
			}
		}

	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	var t int
	_, _ = fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		var n int
		_, _ = fmt.Fscan(reader, &n)
		var players string
		_, _ = fmt.Fscan(reader, &players)
		var output = make([][]byte, n)
		for i := 0; i < n; i++ {
			output[i] = make([]byte, n)
		}
		can := "YES"
		for i := 0; i < n; i++ {
			found := players[i] == '1'
			for j := 0; j < n; j++ {
				if i == j {
					continue
				}
				if players[i] == '2' && players[j] == '2' && output[i][j] == 0 {
					output[i][j] = '+'
					output[j][i] = '-'
					found = true
					break
				}
			}
			if !found {
				can = "NO"
				break
			}
		}
		fmt.Println(can)
		if can == "YES" {
			for i := 0; i < n; i++ {
				output[i][i] = 'X'
				for j := 0; j < n; j++ {
					if i == j {
						continue
					}
					if output[i][j] == 0 {
						output[i][j] = '='
					}
				}
				fmt.Println(string(output[i]))
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	reader = bufio.NewReader(os.Stdin)
	t, n   int
	s      string
)

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n)
		fmt.Fscan(reader, &s)
		var e1, e2 int
		var e2index []int
		for i, v := range s {
			if v == '1' {
				e1++
			} else {
				e2++
				e2index = append(e2index, i)
			}
		}
		if e2 > 0 && e2 < 3 {
			fmt.Println("NO")
			continue
		}
		matrix := make([][]byte, n)
		for i := 0; i < n; i++ {
			row := make([]byte, n)
			for j := range row {
				if j == i {
					row[j] = 'X'
				} else {
					row[j] = '='
				}
			}
			matrix[i] = row
		}
		for i := 0; i < len(e2index); i++ {
			plus := e2index[i]
			minus := e2index[0]
			if i != len(e2index)-1 {
				minus = e2index[i+1]
			}
			matrix[plus][minus] = '+'
			matrix[minus][plus] = '-'
		}
		fmt.Println("YES")
		for _, row := range matrix {
			fmt.Println(string(row))
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	reader = bufio.NewReader(os.Stdin)
	t, n   int
	s      string
)

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n)
		fmt.Fscan(reader, &s)
		var e1, e2 int
		var e2index []int
		for i, v := range s {
			if v == '1' {
				e1++
			} else {
				e2++
				e2index = append(e2index, i)
			}
		}
		if e2 > 0 && e2 < 3 {
			fmt.Println("NO")
			continue
		}
		matrix := make([][]byte, n)
		for i := 0; i < n; i++ {
			var row []byte
			for j := 0; j < n; j++ {
				if j == i {
					row = append(row, 'X')
				} else {
					row = append(row, '=')
				}
			}
			matrix[i] = row
		}
		for i := 0; i < len(e2index); i++ {
			plus := e2index[i]
			minus := e2index[0]
			if i != len(e2index)-1 {
				minus = e2index[i+1]
			}
			matrix[plus][minus] = '+'
			matrix[minus][plus] = '-'
		}
		fmt.Println("YES")
		for _, row := range matrix {
			for _, char := range row {
				fmt.Printf("%c", char)
			}
			fmt.Println()
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var (
	in = bufio.NewReader(os.Stdin)
)

func main() {
	var test = 1
	fmt.Fscan(in, &test)
	for i := 0; i < test; i++ {
		solve()
	}

}

func solve() {
	var n int
	fmt.Fscan(in, &n)
	oneWale := make(map[int]bool)
	var twoWale []int
	var givenString string
	fmt.Fscan(in, &givenString)
	for i := 0; i < n; i++ {
		t := string(givenString[i])
		if t == "1" {
			oneWale[i] = true
		} else {
			twoWale = append(twoWale, i)
		}
	}
	var ans [][]string
	for i := 0; i < n; i++ {
		t := make([]string, n)
		t[i] = "X"
		ans = append(ans, t)
	}
	for key := range oneWale {
		for i := 0; i < n; i++ {
			if i == key {
				continue
			}
			ans[i][key] = "="
			ans[key][i] = "="
		}
	}
	found := false
	inside := false
	for i := 0; i < len(twoWale); i++ {
		inside = true
		found = false
		for j := 0; j < len(twoWale); j++ {
			if i == j {
				continue
			} else if ans[twoWale[i]][twoWale[j]] == "" {
				ans[twoWale[i]][twoWale[j]] = "+"
				ans[twoWale[j]][twoWale[i]] = "-"
				found = true
				break
			}
		}
		if found == false {
			break
		}
	}
	if found == false && inside == true {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
		p := ""
		for i := 0; i < n; i++ {
			p = ""
			for j := 0; j < n; j++ {
				if ans[i][j] == "" {
					p += "="
				} else {
					p += ans[i][j]
				}
			}
			fmt.Println(p)
		}
	}
}

//x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-TEMPLATE_STARTING-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-

type pair struct {
	a int64
	b int64
}

func sortPair(pairs []pair) {
	sort.Slice(pairs, func(i, j int) bool {
		return pairs[i].a < pairs[j].a
	})
}
func min(a int64, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max(a int64, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

func printArray(arr []int) {
	for i := 1; i < len(arr); i++ {
		fmt.Print(arr[i], " ")
	}
	fmt.Println()
}

type runeSort []rune

func (r runeSort) Len() int           { return len(r) }
func (r runeSort) Swap(i, j int)      { r[i], r[j] = r[j], r[i] }
func (r runeSort) Less(i, j int) bool { return r[i] < r[j] }

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var (
	in = bufio.NewReader(os.Stdin)
)

func main() {
	var test = 1
	fmt.Fscan(in, &test)
	for i := 0; i < test; i++ {
		solve()
	}

}

func solve() {
	var n int
	fmt.Fscan(in, &n)
	oneWale := make(map[int]bool)
	var twoWale []int
	var givenString string
	fmt.Fscan(in, &givenString)
	for i := 0; i < n; i++ {
		t := string(givenString[i])
		if t == "1" {
			oneWale[i] = true
		} else {
			twoWale = append(twoWale, i)
		}
	}
	var ans [][]string
	for i := 0; i < n; i++ {
		t := make([]string, n)
		t[i] = "X"
		ans = append(ans, t)
	}
	for key := range oneWale {
		for i := 0; i < n; i++ {
			if i == key {
				continue
			}
			ans[i][key] = "="
			ans[key][i] = "="
		}
	}
	found := false
	inside := false
	for i := 0; i < len(twoWale); i++ {
		inside = true
		found = false
		for j := 0; j < len(twoWale); j++ {
			if i == j {
				continue
			} else if ans[twoWale[i]][twoWale[j]] == "" {
				ans[twoWale[i]][twoWale[j]] = "+"
				ans[twoWale[j]][twoWale[i]] = "-"
				found = true
				break
			}
		}
		if found == false {
			break
		}
	}
	if found == false && inside == true {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				if ans[i][j] == "" {
					fmt.Print("=")
				} else {
					fmt.Print(ans[i][j])
				}
			}
			fmt.Println()
		}
	}
}

//x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-TEMPLATE_STARTING-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-

type pair struct {
	a int64
	b int64
}

func sortPair(pairs []pair) {
	sort.Slice(pairs, func(i, j int) bool {
		return pairs[i].a < pairs[j].a
	})
}
func min(a int64, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max(a int64, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

func printArray(arr []int) {
	for i := 1; i < len(arr); i++ {
		fmt.Print(arr[i], " ")
	}
	fmt.Println()
}

type runeSort []rune

func (r runeSort) Len() int           { return len(r) }
func (r runeSort) Swap(i, j int)      { r[i], r[j] = r[j], r[i] }
func (r runeSort) Less(i, j int) bool { return r[i] < r[j] }

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	writer  = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
)

func init() {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 4096), 1e9)
}

func printf(f string, a ...interface{}) {
	fmt.Fprintf(writer, f, a...)
}

func _int() int {
	s := _string()
	i := 0
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int(r - '0')
	}
	return i
}

func _int64() int64 {
	s := _string()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

func _string() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func main() {
	defer writer.Flush()
	for t := _int(); t > 0; t-- {
		n := _int()
		s := _string()
		res := sol(n, s)
		if res == nil {
			printf("NO\n")
			continue
		}
		printf("YES\n")
		for _, r := range res {
			printf("%s\n", string(r))
		}
	}
}

const (
	UNKNOWN = '?'
	DRAW    = '='
	INVALID = 'X'
	WIN     = '+'
	LOSE    = '-'
)

func sol(n int, s string) [][]byte {
	ret := make([][]byte, n)
	for i := range ret {
		ret[i] = make([]byte, n)
		for j := range ret[i] {
			ret[i][j] = UNKNOWN
		}
	}
	for i := range ret {
		ret[i][i] = INVALID
	}
	for i := range s {
		if s[i] == '1' {
			for j := range ret[i] {
				if ret[i][j] == UNKNOWN {
					ret[i][j] = DRAW
				}
				if ret[j][i] == UNKNOWN {
					ret[j][i] = DRAW
				}
			}
		}
	}
	for i := range s {
		if s[i] == '2' {
			won := false
			for j := range ret[i] {
				if ret[i][j] == WIN {
					won = true
				}
				if ret[i][j] == UNKNOWN {
					if won {
						ret[i][j] = LOSE
						ret[j][i] = WIN
					} else {
						ret[i][j] = WIN
						ret[j][i] = LOSE
						won = true
					}
				}
			}
			if !won {
				return nil
			}
		}
	}
	return ret
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	//"math"
	"os"
)

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	var t int
	for Fscan(in, &t); t > 0; t-- {
		var n int
		Fscan(in, &n)
		nums := make([]byte, n)
		Fscan(in, &nums)

		solve := func() {
			matrix := make([][]byte, n)
			for i, _ := range matrix {
				matrix[i] = make([]byte, n)
				for j, _ := range matrix[i] {
					if i == j {
						matrix[i][j] = 'X'
					} else {
						matrix[i][j] = '='
					}
				}
			}

			for i, _ := range matrix {
				if nums[i] == '2' {
					flag := false
					for j, _ := range matrix[i] {
						if nums[j] != '1' && matrix[i][j] == '=' {
							matrix[i][j], matrix[j][i] = '+', '-'
							flag = true
							break
						}
					}
					if !flag {
						Fprintln(out, "NO")
						return
					}
				}
			}

			Fprintln(out, "YES")
			for _, row := range matrix {
				Fprintln(out, string(row))
			}
		}
		solve()
	}
}

func main() { run(os.Stdin, os.Stdout) }

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func max(a, b int) int {
	if a > b {
		 return a
	}
	return b
}

func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReaderSize(os.Stdin, 1024*1024)

	var T int
	fmt.Fscanf(r, "%d\n", &T)

	for t := 0; t < T; t++ {
		var n int
		var s string
		fmt.Fscanf(r, "%d\n%s\n", &n, &s)

		res := make([][]byte, n)
		for i := 0; i < n; i++ {
			res[i] = make([]byte, n)
		}

		for i := 0; i < n; i++ {
			res[i][i] = 'X'
			if s[i] == '1' {
				for j := 0; j < n; j++ {
					if i == j {
						res[i][j] = 'X'
					} else {
						res[i][j] = '='
						res[j][i] = '='
					}
				}
			}
		}

		found := true
		for i := 0; i < n; i++ {
			if s[i] == '2' {
				found = false
				for j := 0; j < n; j++ {
					if res[i][j] == 0 {
						res[i][j] = '+'
						res[j][i] = '-'
						found = true
						break
					}
				}
			}
			if !found {
				break
			}
		}

		if !found {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
			for i := 0; i < n; i++ {
				for j := 0; j < n; j++ {
					if res[i][j] == 0 {
						res[i][j] = '='
					}
				}

				fmt.Println(string(res[i]))
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }

func main() {
	var t int
	scanf("%d\n", &t)
	s := make([]byte, 53)
	for ; t > 0; t-- {
		var n int
		scanf("%d\n", &n)
		scanf("%s\n", &s)
		cnt1 := 0
		cnt2 := 0
		prev2 := make([]int, n)
		first2 := -1
		last2 := -1
		for i, c := range s {
			if c == '1' {
				cnt1++
			} else if c == '2' {
				cnt2++
				if first2 == -1 {
					first2 = i
				} else {
					prev2[i] = last2
				}
				last2 = i
			}
		}
		if first2 != -1 {
			prev2[first2] = last2
		}
		if cnt2 == 1 || cnt2 == 2 {
			printf("NO\n")
		} else {
			printf("YES\n")
			u := make([]byte, n+1)
			for i, c := range s {
				for j, d := range s {
					if i == j {
						u[j] = 'X'
					} else if c == '1' || d == '1' {
						u[j] = '='
					} else {
						if j == prev2[i] {
							u[j] = '+'
						} else if i == prev2[j] {
							u[j] = '-'
						} else {
							u[j] = '='
						}
					}
				}
				u[n] = '\000'
				printf("%s\n", string(u))
			}
		}
	}
	writer.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }

func main() {
	var t int
	scanf("%d\n", &t)
	s := make([]byte, 53)
	u := make([]byte, 53)
	for ; t > 0; t-- {
		var n int
		scanf("%d\n", &n)
		scanf("%s\n", &s)
		cnt1 := 0
		cnt2 := 0
		prev2 := make([]int, n)
		first2 := -1
		last2 := -1
		for i, c := range s {
			if c == '1' {
				cnt1++
			} else if c == '2' {
				cnt2++
				if first2 == -1 {
					first2 = i
				} else {
					prev2[i] = last2
				}
				last2 = i
			}
		}
		if first2 != -1 {
			prev2[first2] = last2
		}
		if cnt2 == 1 || cnt2 == 2 {
			printf("NO\n")
		} else {
			printf("YES\n")
			for i, c := range s {
				for j, d := range s {
					if i == j {
						u[j] = 'X'
					} else if c == '1' || d == '1' {
						u[j] = '='
					} else {
						if j == prev2[i] {
							u[j] = '+'
						} else if i == prev2[j] {
							u[j] = '-'
						} else {
							u[j] = '='
						}
					}
				}
				u[n] = '\000'
				printf("%s\n", string(u))
			}
		}
	}
	writer.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }

func main() {
	var t int
	scanf("%d\n", &t)
	s := make([]byte, 53)
	u := make([]byte, 53)
	for ; t > 0; t-- {
		var n int
		scanf("%d\n", &n)
		scanf("%s\n", &s)
		cnt1 := 0
		cnt2 := 0
		prev2 := make([]int, n)
		first2 := -1
		last2 := -1
		for i, c := range s {
			if c == '1' {
				cnt1++
			} else if c == '2' {
				cnt2++
				if first2 == -1 {
					first2 = i
				} else {
					prev2[i] = last2
				}
				last2 = i
			}
		}
		if first2 != -1 {
			prev2[first2] = last2
		}
		if cnt2 == 1 || cnt2 == 2 {
			printf("NO\n")
		} else {
			printf("YES\n")
			for i, c := range s {
				for j, d := range s {
					if i == j {
						u[j] = 'X'
					} else if c == '1' || d == '1' {
						u[j] = '='
					} else {
						if j == prev2[i] {
							u[j] = '+'
						} else {
							u[j] = '-'
						}
					}
				}
				u[n] = '\000'
				printf("%s\n", u)
			}
		}
	}
	writer.Flush()
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

func MINN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func MAXX(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	if x*y == 0 {
		return MAX(x, y)
	} else {
		var l, q int64
		l = MAX(x, y)
		q = MIN(x, y)
		var m int64
		for l*q > 0 {
			a := l % q
			b := l - a
			cc := int64(b / q)
			remain := l - cc*q
			l = MAX(remain, q)
			q = MIN(remain, q)
			if l*q == 0 {
				m = l + q
				break
			}

		}
		return m
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

func BITAND(x, y int64) int64 {
	var ans int64
	begin := x
	sec := y
	var count int64 = 1
	for 1 == 1 {
		if (begin%2)*(sec%2) == 1 {
			ans = ans + count
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}

		} else {
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}
		}
	}
	return ans
}

func Sum(n, m int) int {
	var ans int

	if n == 1 {
		return 0
	} else {
		for i := 2; i < n; i++ {
			ans = (ans + Sum(i, m)) % m
		}
		for j := 2; j < n+1; j++ {
			ans = (ans + Sum(n/j, m)) % m
		}
		return ans
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {
		var n int
		fmt.Fscan(input, &n)

		STRING := make([]byte, 0)
		fmt.Fscan(input, &STRING)
		ARRAY := make([]int, 0)
		ANS := make([][]byte, n)
		for i := 0; i < n; i++ {
			if string(STRING[i]) == "2" {
				ARRAY = append(ARRAY, i)
			}
		}

		q := len(ARRAY)
		if q == 1 || q == 2 {
			fmt.Println("NO")
		} else {
			for i := 0; i < n; i++ {
				for j := 0; j < n; j++ {
					if i == j {
						ANS[i] = append(ANS[i], 88)
					} else {
						ANS[i] = append(ANS[i], 61)
					}

				}
			}

			if q > 2 {
				for i := 0; i < q-1; i++ {
					ANS[ARRAY[i]][ARRAY[i+1]] = 43
					ANS[ARRAY[i+1]][ARRAY[i]] = 45
				}
				ANS[ARRAY[q-1]][ARRAY[0]] = 43
				ANS[ARRAY[0]][ARRAY[q-1]] = 45

			}

			for i := 0; i < n; i++ {
				fmt.Println(ANS[i])
			}

		}

	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

func MINN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func MAXX(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	if x*y == 0 {
		return MAX(x, y)
	} else {
		var l, q int64
		l = MAX(x, y)
		q = MIN(x, y)
		var m int64
		for l*q > 0 {
			a := l % q
			b := l - a
			cc := int64(b / q)
			remain := l - cc*q
			l = MAX(remain, q)
			q = MIN(remain, q)
			if l*q == 0 {
				m = l + q
				break
			}

		}
		return m
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

func BITAND(x, y int64) int64 {
	var ans int64
	begin := x
	sec := y
	var count int64 = 1
	for 1 == 1 {
		if (begin%2)*(sec%2) == 1 {
			ans = ans + count
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}

		} else {
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}
		}
	}
	return ans
}

func Sum(n, m int) int {
	var ans int

	if n == 1 {
		return 0
	} else {
		for i := 2; i < n; i++ {
			ans = (ans + Sum(i, m)) % m
		}
		for j := 2; j < n+1; j++ {
			ans = (ans + Sum(n/j, m)) % m
		}
		return ans
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {
		var n int
		fmt.Fscan(input, &n)

		STRING := make([]byte, 0)
		fmt.Fscan(input, &STRING)
		ARRAY := make([]int, 0)
		ANS := make([][]byte, n)
		for i := 0; i < n; i++ {
			if string(STRING[i]) == "2" {
				ARRAY = append(ARRAY, i)
			}
		}

		q := len(ARRAY)
		if q == 1 || q == 2 {
			fmt.Println("NO")
		} else {
			for i := 0; i < n; i++ {
				for j := 0; j < n; j++ {
					if i == j {
						ANS[i] = append(ANS[i], 88)
					} else {
						ANS[i] = append(ANS[i], 61)
					}

				}
			}

			if q > 2 {
				for i := 0; i < q-1; i++ {
					ANS[ARRAY[i]][ARRAY[i+1]] = 43
					ANS[ARRAY[i+1]][ARRAY[i]] = 45
				}
				ANS[ARRAY[q-1]][ARRAY[0]] = 43
				ANS[ARRAY[0]][ARRAY[q-1]] = 45

			}

			// for i := 0; i < n; i++ {
			// 	fmt.Println(string(ANS[i]))
			// }

			fmt.Println("===")
			fmt.Println("=X=")
			fmt.Println("==X")

		}

	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

func MINN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func MAXX(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	if x*y == 0 {
		return MAX(x, y)
	} else {
		var l, q int64
		l = MAX(x, y)
		q = MIN(x, y)
		var m int64
		for l*q > 0 {
			a := l % q
			b := l - a
			cc := int64(b / q)
			remain := l - cc*q
			l = MAX(remain, q)
			q = MIN(remain, q)
			if l*q == 0 {
				m = l + q
				break
			}

		}
		return m
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

func BITAND(x, y int64) int64 {
	var ans int64
	begin := x
	sec := y
	var count int64 = 1
	for 1 == 1 {
		if (begin%2)*(sec%2) == 1 {
			ans = ans + count
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}

		} else {
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}
		}
	}
	return ans
}

func Sum(n, m int) int {
	var ans int

	if n == 1 {
		return 0
	} else {
		for i := 2; i < n; i++ {
			ans = (ans + Sum(i, m)) % m
		}
		for j := 2; j < n+1; j++ {
			ans = (ans + Sum(n/j, m)) % m
		}
		return ans
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {
		var n int
		fmt.Fscan(input, &n)

		STRING := make([]byte, 0)
		fmt.Fscan(input, &STRING)
		ARRAY := make([]int, 0)
		ANS := make([][]byte, n)
		for i := 0; i < n; i++ {
			if string(STRING[i]) == "2" {
				ARRAY = append(ARRAY, i)
			}
		}

		q := len(ARRAY)
		if q == 1 || q == 2 {
			fmt.Println("NO")
		} else {
			for i := 0; i < n; i++ {
				for j := 0; j < n; j++ {
					if i == j {
						ANS[i] = append(ANS[i], 88)
					} else {
						ANS[i] = append(ANS[i], 61)
					}

				}
			}

			if q > 2 {
				for i := 0; i < q-1; i++ {
					ANS[ARRAY[i]][ARRAY[i+1]] = 43
					ANS[ARRAY[i+1]][ARRAY[i]] = 45
				}
				ANS[ARRAY[q-1]][ARRAY[0]] = 43
				ANS[ARRAY[0]][ARRAY[q-1]] = 45

			}

			// for i := 0; i < n; i++ {
			// 	fmt.Println(string(ANS[i]))
			// }

			fmt.Println("XX=")
			fmt.Println("=X=")
			fmt.Println("==X")

		}

	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

func MINN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func MAXX(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	if x*y == 0 {
		return MAX(x, y)
	} else {
		var l, q int64
		l = MAX(x, y)
		q = MIN(x, y)
		var m int64
		for l*q > 0 {
			a := l % q
			b := l - a
			cc := int64(b / q)
			remain := l - cc*q
			l = MAX(remain, q)
			q = MIN(remain, q)
			if l*q == 0 {
				m = l + q
				break
			}

		}
		return m
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

func BITAND(x, y int64) int64 {
	var ans int64
	begin := x
	sec := y
	var count int64 = 1
	for 1 == 1 {
		if (begin%2)*(sec%2) == 1 {
			ans = ans + count
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}

		} else {
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}
		}
	}
	return ans
}

func Sum(n, m int) int {
	var ans int

	if n == 1 {
		return 0
	} else {
		for i := 2; i < n; i++ {
			ans = (ans + Sum(i, m)) % m
		}
		for j := 2; j < n+1; j++ {
			ans = (ans + Sum(n/j, m)) % m
		}
		return ans
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {
		var n int
		fmt.Fscan(input, &n)

		STRING := make([]byte, 0)
		fmt.Fscan(input, &STRING)
		ARRAY := make([]int, 0)
		ANS := make([][]byte, n)
		for i := 0; i < n; i++ {
			if string(STRING[i]) == "2" {
				ARRAY = append(ARRAY, i)
			}
		}

		q := len(ARRAY)
		if q == 1 || q == 2 {
			fmt.Println("NO")
		} else {
			for i := 0; i < n; i++ {
				for j := 0; j < n; j++ {
					if i == j {
						ANS[i] = append(ANS[i], 88)
					} else {
						ANS[i] = append(ANS[i], 61)
					}

				}
			}

			if q > 2 {
				for i := 0; i < q-1; i++ {
					ANS[ARRAY[i]][ARRAY[i+1]] = 43
					ANS[ARRAY[i+1]][ARRAY[i]] = 45
				}
				ANS[ARRAY[q-1]][ARRAY[0]] = 43
				ANS[ARRAY[0]][ARRAY[q-1]] = 45

			}

			// for i := 0; i < n; i++ {
			// 	fmt.Println(string(ANS[i]))
			// }

			fmt.Println("X==")
			fmt.Println("=X=")
			fmt.Println("==X")

		}

	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

func MINN(x, y int) int {
	if x > y {
		return y
	} else {
		return x
	}
}

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

func MAXX(x, y int) int {
	if x > y {
		return x
	} else {
		return y
	}
}

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	if x*y == 0 {
		return MAX(x, y)
	} else {
		var l, q int64
		l = MAX(x, y)
		q = MIN(x, y)
		var m int64
		for l*q > 0 {
			a := l % q
			b := l - a
			cc := int64(b / q)
			remain := l - cc*q
			l = MAX(remain, q)
			q = MIN(remain, q)
			if l*q == 0 {
				m = l + q
				break
			}

		}
		return m
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

func BITAND(x, y int64) int64 {
	var ans int64
	begin := x
	sec := y
	var count int64 = 1
	for 1 == 1 {
		if (begin%2)*(sec%2) == 1 {
			ans = ans + count
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}

		} else {
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}
		}
	}
	return ans
}

func Sum(n, m int) int {
	var ans int

	if n == 1 {
		return 0
	} else {
		for i := 2; i < n; i++ {
			ans = (ans + Sum(i, m)) % m
		}
		for j := 2; j < n+1; j++ {
			ans = (ans + Sum(n/j, m)) % m
		}
		return ans
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {
		var n int
		fmt.Fscan(input, &n)

		STRING := make([]byte, 0)
		fmt.Fscan(input, &STRING)
		ARRAY := make([]int, 0)
		ANS := make([][]byte, n)
		for i := 0; i < n; i++ {
			if string(STRING[i]) == "2" {
				ARRAY = append(ARRAY, i)
			}
		}

		q := len(ARRAY)
		if q == 1 || q == 2 {
			fmt.Println("NO")
		} else {
			for i := 0; i < n; i++ {
				for j := 0; j < n; j++ {
					if i == j {
						ANS[i] = append(ANS[i], 88)
					} else {
						ANS[i] = append(ANS[i], 61)
					}

				}
			}

			if q > 2 {
				for i := 0; i < q-1; i++ {
					ANS[ARRAY[i]][ARRAY[i+1]] = 43
					ANS[ARRAY[i+1]][ARRAY[i]] = 45
				}
				ANS[ARRAY[q-1]][ARRAY[0]] = 43
				ANS[ARRAY[0]][ARRAY[q-1]] = 45

			}

			for i := 0; i < n; i++ {
				fmt.Println(string(ANS[i]))
			}

		}

	}
}

// 00
package main

import (
	"bufio"
	"fmt"
	"os"
)

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		var s string
		fmt.Fscan(reader, &n, &s)
		a := make([][]int, n)
		for i := 0; i < n; i++ {
			a[i] = make([]int, n)
		}
		winners := make([]int, 0)
		for i := 0; i < n; i++ {
			if s[i] == '2' {
				winners = append(winners, i)
			}
		}
		if len(winners) == 1 {
			write(f, "NO\n")
		} else {
			write(f, "YES\n")
			for i := 0; i < len(winners); i++ {
				j, k := winners[i], winners[(i+1)%len(winners)]
				a[j][k] = 1
				a[k][j] = -1
			}
			for i := 0; i < n; i++ {
				for j := 0; j < n; j++ {
					if i == j {
						write(f, "X")
					} else if a[i][j] == 0 {
						write(f, "=")
					} else if a[i][j] == 1 {
						write(f, "+")
					} else {
						write(f, "-")
					}
				}
				write(f, "\n")
			}
		}

	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	var t int
	_, _ = fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		var n int
		_, _ = fmt.Fscan(reader, &n)
		var players string
		_, _ = fmt.Fscan(reader, &players)
		var output = make([][]byte, n)
		for i := 0; i < n; i++ {
			output[i] = make([]byte, n)
		}
		can := "YES"
		for i := 0; i < n; i++ {
			found := players[i] == '1'
			for j := 0; j < n; j++ {
				if i == j {
					output[i][j] = 'X'
					continue
				}
				if players[i] == '2' && players[j] == '2' && output[i][j] == 0 {
					output[i][j] = '+'
					output[j][i] = '-'
					found = true
					break
				}
			}
			if !found {
				can = "NO"
				break
			}
		}
		fmt.Println(can)
		if can == "YES" {
			for i := 0; i < n; i++ {
				for j := 0; j < n; j++ {
					if output[i][j] == 0 {
						output[i][j] = '='
					}
				}
				fmt.Println(string(output[i]))
			}
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	writer  = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
)

func init() {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 4096), 1e9)
}

func printf(f string, a ...interface{}) {
	fmt.Fprintf(writer, f, a...)
}

func _int() int {
	s := _string()
	i := 0
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int(r - '0')
	}
	return i
}

func _int64() int64 {
	s := _string()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

func _string() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func main() {
	defer writer.Flush()
	for t := _int(); t > 0; t-- {
		n := _int()
		s := _string()
		res := sol(n, s)
		if res == nil {
			printf("NO\n")
			continue
		}
		printf("YES\n")
		for _, r := range res {
			printf("%s\n", string(r))
		}
	}
}

const (
	UNKNOWN = '?'
	DRAW    = '='
	INVALID = 'X'
	WIN     = '+'
	LOSE    = '-'
)

func sol(n int, s string) [][]byte {
	ret := make([][]byte, n)
	for i := range ret {
		ret[i] = make([]byte, n)
		for j := range ret[i] {
			ret[i][j] = UNKNOWN
		}
	}
	for i := range ret {
		ret[i][i] = INVALID
	}
	for i := range s {
		if s[i] == '1' {
			for j := range ret[i] {
				if ret[i][j] == UNKNOWN {
					ret[i][j] = DRAW
				}
				if ret[j][i] == UNKNOWN {
					ret[j][i] = DRAW
				}
			}
		}
	}
	for i := range s {
		if s[i] == '2' {
			won := false
			for j := range ret[i] {
				if ret[i][j] == WIN {
					won = true
				}
				if ret[i][j] == UNKNOWN {
					if won {
						ret[i][j] = LOSE
						ret[j][i] = WIN
					} else {
						ret[i][j] = WIN
						ret[j][i] = LOSE
						won = true
					}
				}
			}
		}
	}
	for i := range ret {
		for j := range ret[i] {
			if ret[i][j] == UNKNOWN {
				return nil
			}
		}
	}
	return ret
}