package main

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

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

	solve := func() {
		var n int
		Fscan(in, &n)
		a := make([][]byte, n)
		for i := 0; i < n; i++ {
			Fscan(in, &a[i])
		}
		x := make(map[int]int)
		y := make(map[int]int)
		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				if a[i][j] == '*' {
					x[i] = 1
					y[j] = 1
				}
			}
		}
		if len(x) == 1 {
			var _x int
			for i, _ := range x {
				_x = i
			}
			x[(_x+1)%n] = 1
		}
		if len(y) == 1 {
			var _y int
			for i, _ := range y {
				_y = i
			}
			y[(_y+1)%n] = 1
		}
		for i, _ := range x {
			for j, _ := range y {
				a[i][j] = '*'
			}
		}
		for i := 0; i < n; i++ {
			Fprintln(out, string(a[i]))
		}

	}

	var T int
	Fscan(in, &T)
	for o := 0; o < T; o++ {
		solve()
	}

}

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

package main
import(
    "fmt"
    "bufio"
    "os"
)
type coords struct{
	row int
	column int
}
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		var star1,star2 coords
		counter:=0
		for j:=0;j<n;j++{
			var x string
			fmt.Fscan(in,&x)
			for k:=0;k<n;k++{
				if string(x[k]) == "*" {
					if counter == 0 {
						star1.row,star1.column = j,k
						counter++
					} else {
						star2.row,star2.column = j,k
					}
				}
			}
		}

		var star3,star4 coords
		if star1.row == star2.row {
			if star1.row == 0 {
				star3.row,star4.row= star1.row+1,star1.row+1
			} else {
				star3.row,star4.row= star1.row-1,star1.row-1
			}
			star3.column,star4.column= star1.column,star2.column

		} else if star1.column == star2.column {
			if star1.column == 0 {
				star3.column,star4.column= star1.column+1,star2.column+1
			} else {
				star3.column,star4.column= star1.column-1,star1.column-1
			}
			star3.row,star4.row= star1.row,star2.row

		} else {
			star3.row,star3.column= star1.row,star2.column
			star4.row,star4.column= star2.row,star1.column
		}
		for j:=0;j<n;j++{
			for k:=0;k<n;k++{
				if (k == star1.column && j == star1.row) || (k == star2.column && j == star2.row) || (k == star3.column && j == star3.row) || (k == star4.column && j == star4.row){
					fmt.Fprintf(out,"*")
				} else {
					fmt.Fprintf(out,".")
				}
			}
			fmt.Fprintln(out,)
		}
	}
}

package main

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

var reader = bufio.NewReader(os.Stdin)

func ri() int {
	var x int
	c, _ := reader.ReadByte()
	for c < '0' || c > '9' {
		c, _ = reader.ReadByte()
	}
	for '0' <= c && c <= '9' {
		x = (x << 3) + (x << 1) + int(c) - '0'
		c, _ = reader.ReadByte()
	}
	return x
}

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

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

const MAXN = 2e5 + 5

type Node struct {
	x, y int
}

func Solve() {
	var mp [][]rune
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var s string
		fmt.Scan(&s)
		mp = append(mp, []rune(s))
	}
	var tmp []Node
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if mp[i][j] == '*' {
				tmp = append(tmp, Node{i, j})
			}
		}
	}
	switch {
	case tmp[0].x == tmp[1].x:
		if tmp[0].x == 0 {
			mp[tmp[0].x+1][tmp[0].y] = '*'
			mp[tmp[0].x+1][tmp[1].y] = '*'
		} else {
			mp[tmp[0].x-1][tmp[0].y] = '*'
			mp[tmp[0].x-1][tmp[1].y] = '*'
		}
	case tmp[0].y == tmp[1].y:
		if tmp[0].y == 0 {
			mp[tmp[0].x][tmp[0].y+1] = '*'
			mp[tmp[1].x][tmp[0].y+1] = '*'
		} else {
			mp[tmp[0].x][tmp[0].y-1] = '*'
			mp[tmp[1].x][tmp[0].y-1] = '*'
		}
	default:
		mp[tmp[0].x][tmp[1].y] = '*'
		mp[tmp[1].x][tmp[0].y] = '*'
	}
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			fmt.Printf("%c", mp[i][j])
		}
		fmt.Println()
	}
}

func main() {
	var T = 0
	if T == 0 {
		fmt.Scan(&T)
	}
	for t := 1; t <= T; t++ {
		Solve()
	}
}

package main

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

type CF1512B struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1512B) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1512B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1512B) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1512B) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1512B) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1512B
Date: 21/11/21
User: epradere
URL: https://codeforces.com/problemset/problem/1512/B
Problem: CF1512B
**/
func (in *CF1512B) Run() {
	t := in.NextInt()
	for ; t > 0; t-- {
		n := in.NextInt()
		arr := make([][]rune, n)
		pos := make([][]int, 0)
		for i := 0; i < n; i++ {
			str := in.NextString()
			line := make([]rune, n)
			for j := 0; j < n; j++ {
				line[j] = rune(str[j])
				if line[j] == '*' {
					pos = append(pos, []int{i, j})
				}
			}
			arr[i] = line
		}

		x1, y1 := pos[0][0], pos[0][1]
		x2, y2 := pos[1][0], pos[1][1]

		if x1 == x2 {
			if x1 == 0 {
				arr[x1+1][y1] = '*'
				arr[x2+1][y2] = '*'
			} else {
				arr[x1-1][y1] = '*'
				arr[x2-1][y2] = '*'
			}
		} else if y1 == y2 {
			if y1 == 0 {
				arr[x1][y1+1] = '*'
				arr[x2][y2+1] = '*'
			} else {
				arr[x1][y1-1] = '*'
				arr[x2][y2-1] = '*'
			}
		} else {
			arr[x1][y2] = '*'
			arr[x2][y1] = '*'
		}

		var sb strings.Builder

		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				sb.WriteRune(arr[i][j])
			}
			sb.WriteString("\n")
		}
		fmt.Print(sb.String())
	}
}

func NewCF1512B(r *bufio.Reader) *CF1512B {
	return &CF1512B{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1512B(bufio.NewReader(os.Stdin)).Run()
}

package main

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

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

func solve(n int, m [][]byte) {
	var (
		x, y [2]int
		k    int
	)
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if m[i][j] == '*' {
				x[k] = i
				y[k] = j
				k++
			}
		}
	}
	if x[0] != x[1] && y[0] != y[1] {
		y[0], y[1] = y[1], y[0]
	} else if x[0] == x[1] {
		if x[0] > 0 {
			x[0] = 0
			x[1] = 0
		} else {
			x[0] = 1
			x[1] = 1
		}
	} else {
		if y[0] > 0 {
			y[0] = 0
			y[1] = 0
		} else {
			y[0] = 1
			y[1] = 1
		}
	}
	m[x[0]][y[0]] = '*'
	m[x[1]][y[1]] = '*'
	for _, v := range m {
		fmt.Printf("%s\n", v)
	}
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n)
		m := make([][]byte, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &m[i])
		}
		solve(n, m)
	}
}

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"os"
	"strings"
)

var bytes []byte

func nextByte() byte {
	b := bytes[0]
	bytes = bytes[1:]
	return b
}

func ScanInt64() int64 {
	var negative bool
	var result int64

	b := nextByte()

	for ; b < '0' || b > '9'; b = nextByte() {
		if b == '-' {
			negative = true
		}
	}

	for ; '0' <= b && b <= '9'; b = nextByte() {
		result = (result << 3) + (result << 1) + int64(b-'0')
	}

	if negative {
		return -result
	} else {
		return result
	}
}

func ScanInt() int {
	return int(ScanInt64())
}

func ScanString() string {
	builder := strings.Builder{}

	for b := nextByte(); b != '\r'; b = nextByte() {
		if b != '\n' {
			builder.WriteByte(b)
		}
	}

	return builder.String()
}

func init() {
	f, err := os.Open("in.txt")

	if err == nil {
		defer f.Close()
	} else {
		f = os.Stdin
	}

	bytes, _ = ioutil.ReadAll(bufio.NewReader(f))
}

func main() {
	for t := ScanInt(); t > 0; t-- {
		n := ScanInt()
		field := make([][]rune, n)
		minR, maxR, minC, maxC := n-1, 0, n-1, 0

		for r := 0; r < n; r++ {
			field[r] = []rune(ScanString())

			for c := 0; c < n; c++ {
				if field[r][c] == '*' {
					if r < minR {
						minR = r
					}

					if r > maxR {
						maxR = r
					}

					if c < minC {
						minC = c
					}

					if c > maxC {
						maxC = c
					}
				}
			}
		}

		if minR == maxR {
			if minR > 0 {
				minR--
			} else {
				maxR++
			}
		}

		if minC == maxC {
			if minC > 0 {
				minC--
			} else {
				maxC++
			}
		}

		field[minR][minC] = '*'
		field[minR][maxC] = '*'
		field[maxR][minC] = '*'
		field[maxR][maxC] = '*'

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

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(in, &t)
	for t > 0 {
		t--
		var n int
		fmt.Fscan(in, &n)
		v := make([][]rune, n)
		mnR, mnC, mxR, mxC := n,n,0,0
		for i := range v {
			v[i] = make([]rune, n + 1)
			var s string
			fmt.Fscan(in, &s)
			v[i] = []rune(s)
			for j, c := range v[i] {
				if c == '*' {
					mnR = int(math.Min(float64(mnR), float64(i)))
					mnC = int(math.Min(float64(mnC), float64(j)))
					mxR = int(math.Max(float64(mxR), float64(i)))
					mxC = int(math.Max(float64(mxC), float64(j)))
				}
			}
		}
		if mnR == mxR {
			mxR = (mxR+1)%n
		}
		if mnC == mxC {
			mxC = (mxC+1)%n
		}
		v[mnR][mnC] = '*'
		v[mnR][mxC] = '*'
		v[mxR][mnC] = '*'
		v[mxR][mxC] = '*'
		for _, s := range v {
			fmt.Println(string(s))
		}
	}
}

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])
// }

func MIN(x, y int64) int64 {
	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 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 {
	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
		}
	}

}

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

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)

	for i := 0; i < t; i++ {
		var n int
		fmt.Fscan(input, &n)

		array := make([]string, n)
		Rows := make([]int, 0)
		Columns := make([]int, 0)
		for i := 0; i < n; i++ {
			BBB := make([]byte, 0)
			fmt.Fscan(input, &BBB)
			for k := 0; k < n; k++ {
				if string(BBB[k]) == "*" {
					Rows = append(Rows, i)
					Columns = append(Columns, k)
				}
			}
			array[i] = string(BBB)
		}
		if Rows[0] == Rows[1] {
			if Rows[0] < n-1 {
				array[n-1] = array[n-1][:Columns[0]] + "*" + array[n-1][Columns[0]+1:Columns[1]] + "*" + array[n-1][Columns[1]+1:]
			} else {
				array[0] = array[0][:Columns[0]] + "*" + array[0][Columns[0]+1:Columns[1]] + "*" + array[0][Columns[1]+1:]

			}
		} else {
			if Columns[0] == Columns[1] {
				if Columns[0] < n-1 {
					array[Rows[0]] = array[Rows[0]][:n-1] + "*"
					array[Rows[1]] = array[Rows[0]][:n-1] + "*"

				} else {
					array[Rows[0]] = "*" + array[Rows[0]][1:]
					array[Rows[1]] = "*" + array[Rows[0]][1:]
				}
			} else {
				array[Rows[0]] = array[Rows[0]][:Columns[1]] + "*" + array[Rows[0]][Columns[1]+1:]
				array[Rows[1]] = array[Rows[1]][:Columns[0]] + "*" + array[Rows[1]][Columns[0]+1:]
			}
		}
		for i := 0; i < n; i++ {
			fmt.Println(array[i])
		}

	}

}

package main

import "fmt"

func solve() {
	var n int
	fmt.Scan(&n)
	in := make([][]byte, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&in[i])
	}
	first_i := -1
	first_j := -1
	second_i := -1
	second_j := -1
	for i := 0; i < n; i++ {
		for id, elem := range in[i] {
			if elem == '*' && first_i == -1 {
				first_i = i
				first_j = id
			} else if elem == '*' && second_i == -1 {
				second_i = i
				second_j = id
			}
		}
	}
	if second_j == first_j {
		if second_j < n-1 {
			in[first_i][first_j+1] = '*'
			in[second_i][second_j+1] = '*'
		} else {
			in[first_i][first_j-1] = '*'
			in[second_i][second_j-1] = '*'
		}
	} else if second_i == first_i {
		if second_i < n-1 {
			in[first_i+1][first_j] = '*'
			in[second_i+1][second_j] = '*'
		} else {
			in[first_i-1][first_j] = '*'
			in[second_i-1][second_j] = '*'
		}
	} else {
		in[first_i][second_j] = '*'
		in[second_i][first_j] = '*'
	}
	ans := ""
	for i := range in {
		for j := range in[i] {
			ans += string(in[i][j])
			if j == n-1 {
				ans += "\n"
			}
		}
	}
	fmt.Print(ans)

}

func main() {
	var x int
	fmt.Scan(&x)
	for i := 0; i < x; i++ {
		solve()
	}
}

package main

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

type Scanner struct {
	bScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bScanner := bufio.NewScanner(os.Stdin)
	bScanner.Split(bufio.ScanWords)
	bScanner.Buffer([]byte{}, math.MaxInt32)
	return &Scanner{
		bScanner,
	}
}
func (s *Scanner) next() string {
	s.bScanner.Scan()
	return s.bScanner.Text()
}
func (s *Scanner) nextInt() int {
	s.bScanner.Scan()
	res, err := strconv.Atoi(s.bScanner.Text())
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextInt64() int64 {
	s.bScanner.Scan()
	res, err := strconv.ParseInt(s.bScanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextFloat() float64 {
	s.bScanner.Scan()
	res, err := strconv.ParseFloat(s.bScanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return res
}
func (s *Scanner) nextInts(N int) []int {
	res := make([]int, N)
	for i := 0; i < N; i++ {
		res[i] = s.nextInt()
	}
	return res
}
func (s *Scanner) nextInt64s(N int) []int64 {
	res := make([]int64, N)
	for i := 0; i < N; i++ {
		res[i] = s.nextInt64()
	}
	return res
}
func min(nums ...int) int {
	ans := math.MaxInt32
	for _, num := range nums {
		if num < ans {
			ans = num
		}
	}
	return ans
}
func max(nums ...int) int {
	ans := math.MinInt32
	for _, num := range nums {
		if num > ans {
			ans = num
		}
	}
	return ans
}

func main() {
	sc := NewScanner()
	wr := bufio.NewWriter(os.Stdout)
	defer wr.Flush()

	TC := sc.nextInt()
	for tc := 0; tc < TC; tc++ {
		N := sc.nextInt()
		grid := make([][]byte, N)
		for i := 0; i < N; i++ {
			grid[i] = []byte(sc.next())
		}

		minr := 500
		maxr := 0
		minc := 500
		maxc := 0
		for i := 0; i < N; i++ {
			for j := 0; j < N; j++ {
				if grid[i][j] == '*' {
					minr = min(minr, i)
					maxr = max(maxr, i)
					minc = min(minc, j)
					maxc = max(maxc, j)
				}
			}
		}
		height := max(1, maxr-minr)
		width := max(1, maxc-minc)

		if maxr-height >= 0 {
			minr = maxr - height
		} else {
			maxr = maxr + height
		}
		if maxc-width >= 0 {
			minc = maxc - width
		} else {
			maxc = maxc + width
		}
		grid[minr][minc] = '*'
		grid[minr][maxc] = '*'
		grid[maxr][minc] = '*'
		grid[maxr][maxc] = '*'

		for i := 0; i < N; i++ {
			fmt.Fprintln(wr, string(grid[i]))
		}
	}

}

package main

import (
	"bufio"
	"bytes"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"strings"
)

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	solve := func(Case int) {
		var n, maxr, maxc int
		Fscan(in, &n)
		a := make([][]byte, n)
		minr := -1
		minc := int(1e9)
		for i := range a {
			Fscan(in, &a[i])
			l, r := bytes.Index(a[i], []byte{'*'}), bytes.LastIndex(a[i], []byte{'*'})
			if l >= 0 {
				if minr == -1 {
					minr = i
				}
				maxr = i
				minc = min(minc, l)
				maxc = max(maxc, r)
			}
		}
		a[minr][minc] = '*'
		a[minr][maxc] = '*'
		a[maxr][minc] = '*'
		a[maxr][maxc] = '*'

		if maxr == minr {
			if minr > 0 {
				a[minr-1][minc] = '*'
				a[minr-1][maxc] = '*'
			} else {
				a[minr+1][minc] = '*'
				a[minr+1][maxc] = '*'
			}
		} else if maxc == minc {
			if minc > 0 {
				a[minr][minc-1] = '*'
				a[maxr][minc-1] = '*'
			} else {
				a[minr][minc+1] = '*'
				a[maxr][minc+1] = '*'
			}
		}

		for _, s := range a {
			Fprintln(out, string(s))
		}
	}

	var T int
	Fscan(in, &T)
	for Case := 1; Case <= T; Case++ {
		solve(Case)
	}

	_leftData, _ := ioutil.ReadAll(in)
	if _s := strings.TrimSpace(string(_leftData)); _s != "" {
		panic("有未读入的数据：\n" + _s)
	}
}

func main() { run(os.Stdin, os.Stdout) }
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

package main

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

func (in *B) run() {
	t := in.nextInt()
	for i := 0; i < t; i++ {
		n := in.nextInt()
		cm := make([][]byte, n)
		for i := 0; i < n; i++ {
			cm[i] = []byte(in.nextString())
		}
		point := []complex64{complex(0, 0), complex(0, 0)}
		c := 0
		for y := 0; y < n; y++ {
			for x := 0; x < n; x++ {
				if cm[y][x] == '*' {
					point[c] = complex(float32(x), float32(y))
					c++
				}
			}
		}

		if real(point[0]) == real(point[1]) {
			cm[(int(imag(point[0])))%n][(int(real(point[0]))+1)%n] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[1]))+1)%n] = '*'
		} else if imag(point[0]) == imag(point[1]) {
			cm[(int(imag(point[0]))+1)%n][(int(real(point[0])))%n] = '*'
			cm[(int(imag(point[1]))+1)%n][(int(real(point[1])))%n] = '*'
		} else {
			cm[(int(imag(point[0])))%n][(int(real(point[1])))] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[0])))] = '*'

		}
		for y := 0; y < n; y++ {
			Printf("%s\n", string(cm[y]))
		}
	}
}

func main() {
	var F *bufio.Reader
	in, inErr := os.Open("in.txt")
	if inErr == nil {
		F = bufio.NewReader(in)
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(in)
	NewB(F).run()
}

func NewB(r *bufio.Reader) *B {
	return &B{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type B struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *B) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *B) nextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *B) nextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *B) nextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

package main

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

func (in *B) run(out *bufio.Writer) {
	t := in.nextInt()
	for i := 0; i < t; i++ {
		n := in.nextInt()
		cm := make([][]byte, n)
		for i := 0; i < n; i++ {
			cm[i] = []byte(in.nextString())
		}
		point := []complex64{complex(0, 0), complex(0, 0)}
		c := 0
		for y := 0; y < n; y++ {
			for x := 0; x < n; x++ {
				if cm[y][x] == '*' {
					point[c] = complex(float32(x), float32(y))
					c++
				}
			}
		}

		if real(point[0]) == real(point[1]) {
			cm[(int(imag(point[0])))%n][(int(real(point[0]))+1)%n] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[1]))+1)%n] = '*'
		} else if imag(point[0]) == imag(point[1]) {
			cm[(int(imag(point[0]))+1)%n][(int(real(point[0])))%n] = '*'
			cm[(int(imag(point[1]))+1)%n][(int(real(point[1])))%n] = '*'
		} else {
			cm[(int(imag(point[0])))%n][(int(real(point[1])))] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[0])))] = '*'

		}
		for y := 0; y < n; y++ {
			Printf("%s\n", string(cm[y]))
		}
	}
}

func main() {
	var F *bufio.Reader
	var W *bufio.Writer
	in, inErr := os.Open("in.txt")
	out, outErr := os.Create("out.txt")
	if inErr == nil {
		F = bufio.NewReader(in)
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	created := false
	if outErr == nil {
		created = true
		W = bufio.NewWriter(out)
	} else {
		W = bufio.NewWriter(os.Stdout)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(in)
	defer func(file *os.File) {
		if created {
			_ = W.Flush()
		}
		_ = file.Close()
	}(out)

	NewB(F).run(W)
}

func NewB(r *bufio.Reader) *B {
	return &B{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type B struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *B) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *B) nextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *B) nextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *B) nextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

package main

import (
	"fmt"
	"strings"
)

var answer string

func main() {
	it := 0
	fmt.Scanf("%d\n", &it)
	for l := 0; l < it; l++ {
		x := 0
		fmt.Scanf("%d\n", &x)
		s := make([][]rune, x)
		for i := 0; i < x; i++ {
			s[i] = make([]rune, x)
		}

		fpx, fpy := -1, -1
		fpxx, fpyy := -1, -1

		for i := 0; i < x; i++ {
			var is string
			// switch i {
			// case 0:
			// 	is = "....."

			// case 1:
			// 	is = "..*.."

			// case 2:
			// 	is = "....."

			// case 3:
			// 	is = ".*..."

			// case 4:
			// 	is = "....."
			// }
			fmt.Scanf("%s\n", &is)
			for k, ss := range is {
				if ss == '*' && fpx == -1 {
					fpy = i
					fpx = k
				} else if ss == '*' && fpx != -1 {
					fpyy = i
					fpxx = k
				}
			}
		}
		print_matrix(fpx, fpy, fpxx, fpyy, x)
	}
	fmt.Println(answer)
}

func print_matrix(x1, y1, x2, y2, x int) {
	// fmt.Println("========")
	if x1 == x2 {
		if x1 > 0 {
			x2--
		} else {
			x2++
		}
	}
	if y1 == y2 {
		if y1 > 0 {
			y2--
		} else {
			y2++
		}
	}
	for i := 0; i < x; i++ {
		if i != y1 && i != y2 {
			// fmt.Println(strings.Repeat(".", x))
			answer += (strings.Repeat(".", x)) + "\n"
		} else {
			str := ""
			for k := 0; k < x; k++ {
				if k == x1 || k == x2 {
					str += "*"
				} else {
					str += "."
				}
			}
			answer += str + "\n"

		}
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	var (
		line      string
		char      uint8
		setCount  int
		size      int
		rowsCount int
	)

	firstX := -1
	firstY := -1
	secondX := -1
	secondY := -1
	thirdX := -1
	thirdY := -1
	fourthX := -1
	fourthY := -1

	for scanner.Scan() {
		line = scanner.Text()

		if setCount == 0 {
			setCount = parseInt(line)
			continue
		}

		if size == 0 {
			size = parseInt(line)
			continue
		}

		if rowsCount != size {
			for x := 0; x < size; x++ {
				char = line[x]

				if char == '*' {
					if firstX == -1 {
						firstX = x
						firstY = rowsCount
					} else {
						secondX = x
						secondY = rowsCount
					}
				}
			}

			rowsCount++

			if rowsCount != size {
				continue
			}
		}

		thirdX, thirdY, fourthX, fourthY = findRectangle(firstX, firstY, secondX, secondY, size)

		printMatrix(firstX, firstY, secondX, secondY, thirdX, thirdY, fourthX, fourthY, size)

		// обнуление
		size = 0
		rowsCount = 0
		firstX = -1
		firstY = -1
		secondX = -1
		secondY = -1
		thirdX = -1
		thirdY = -1
		fourthX = -1
		fourthY = -1
	}
}

func parseInt(line string) int {
	i, err := strconv.Atoi(line)
	if err != nil {
		panic(err)
	}

	return i
}

func findRectangle(firstX, firstY, secondX, secondY, size int) (int, int, int, int) {
	var (
		thirdX, thirdY, fourthX, fourthY int
	)

	switch {
	// в плоскости X
	case isPointsInPlaneX(firstX, firstY, secondX, secondY):
		thirdX = firstX
		thirdY = firstY + 1

		// на границе матрицы
		if firstY == (size - 1) {
			thirdY = firstY - 1
		}

		fourthX = secondX
		fourthY = thirdY

	// в плоскости Y
	case isPointsInPlaneY(firstX, firstY, secondX, secondY):
		thirdX = firstX + 1

		// на границе матрицы
		if firstX == (size - 1) {
			thirdX = firstX - 1
		}

		thirdY = firstY
		fourthX = thirdX
		fourthY = secondY

	// по диагонали
	default:
		thirdX = secondX
		thirdY = firstY
		fourthX = firstX
		fourthY = secondY
	}

	return thirdX, thirdY, fourthX, fourthY
}

func isPointsInPlaneX(_, firstY, _, secondY int) bool {
	return firstY == secondY
}

func isPointsInPlaneY(firstX, _, secondX, _ int) bool {
	return firstX == secondX
}

var buf bytes.Buffer

func printMatrix(firstX, firstY, secondX, secondY, thirdX, thirdY, fourthX, fourthY, size int) {
	buf.Reset()

	for y := 0; y < size; y++ {
		for x := 0; x < size; x++ {
			switch {
			case firstX == x && firstY == y,
				secondX == x && secondY == y,
				thirdX == x && thirdY == y,
				fourthX == x && fourthY == y:
				buf.WriteRune('*')
			default:
				buf.WriteRune('.')
			}
		}

		buf.WriteRune('\n')
	}

	fmt.Print(buf.String())
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	var (
		line      string
		char      uint8
		setCount  int
		size      int
		rowsCount int
	)

	firstX := -1
	firstY := -1
	secondX := -1
	secondY := -1
	thirdX := -1
	thirdY := -1
	fourthX := -1
	fourthY := -1

	for scanner.Scan() {
		line = scanner.Text()

		if setCount == 0 {
			setCount = parseInt(line)
			continue
		}

		if size == 0 {
			size = parseInt(line)
			continue
		}

		if rowsCount != size {
			for x := 0; x < size; x++ {
				char = line[x]

				if char == '*' {
					if firstX == -1 {
						firstX = x
						firstY = rowsCount
					} else {
						secondX = x
						secondY = rowsCount
					}
				}
			}

			rowsCount++

			if rowsCount != size {
				continue
			}
		}

		thirdX, thirdY, fourthX, fourthY = findRectangle(firstX, firstY, secondX, secondY, size)

		printMatrix(firstX, firstY, secondX, secondY, thirdX, thirdY, fourthX, fourthY, size)

		// обнуление
		size = 0
		rowsCount = 0
		firstX = -1
		firstY = -1
		secondX = -1
		secondY = -1
		thirdX = -1
		thirdY = -1
		fourthX = -1
		fourthY = -1
	}
}

func parseInt(line string) int {
	i, err := strconv.Atoi(line)
	if err != nil {
		panic(err)
	}

	return i
}

func findRectangle(firstX, firstY, secondX, secondY, size int) (int, int, int, int) {
	var (
		thirdX, thirdY, fourthX, fourthY int
	)

	switch {
	// в плоскости X
	case isPointsInPlaneX(firstX, firstY, secondX, secondY):
		thirdX = firstX
		thirdY = firstY + 1

		// на границе матрицы
		if firstY == (size - 1) {
			thirdY = firstY - 1
		}

		fourthX = secondX
		fourthY = thirdY

	// в плоскости Y
	case isPointsInPlaneY(firstX, firstY, secondX, secondY):
		thirdX = firstX + 1

		// на границе матрицы
		if firstX == (size - 1) {
			thirdX = firstX - 1
		}

		thirdY = firstY
		fourthX = thirdX
		fourthY = secondY

	// по диагонали
	default:
		thirdX = secondX
		thirdY = firstY
		fourthX = firstX
		fourthY = secondY
	}

	return thirdX, thirdY, fourthX, fourthY
}

func isPointsInPlaneX(_, firstY, _, secondY int) bool {
	return firstY == secondY
}

func isPointsInPlaneY(firstX, _, secondX, _ int) bool {
	return firstX == secondX
}

func printMatrix(firstX, firstY, secondX, secondY, thirdX, thirdY, fourthX, fourthY, size int) {
	var buf bytes.Buffer
	for y := 0; y < size; y++ {
		for x := 0; x < size; x++ {
			switch {
			case firstX == x && firstY == y,
				secondX == x && secondY == y,
				thirdX == x && thirdY == y,
				fourthX == x && fourthY == y:
				buf.WriteRune('*')
			default:
				buf.WriteRune('.')
			}
		}

		buf.WriteRune('\n')
	}

	fmt.Print(buf.String())
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	var (
		line      string
		char      uint8
		setCount  int
		size      int
		rowsCount int
	)

	firstX := -1
	firstY := -1
	secondX := -1
	secondY := -1
	thirdX := -1
	thirdY := -1
	fourthX := -1
	fourthY := -1

	for scanner.Scan() {
		line = scanner.Text()

		if setCount == 0 {
			setCount = parseInt(line)
			continue
		}

		if size == 0 {
			size = parseInt(line)
			continue
		}

		if rowsCount != size {
			for x := 0; x < size; x++ {
				char = line[x]

				if char == '*' {
					if firstX == -1 {
						firstX = x
						firstY = rowsCount
					} else {
						secondX = x
						secondY = rowsCount
					}
				}
			}

			rowsCount++

			if rowsCount != size {
				continue
			}
		}

		thirdX, thirdY, fourthX, fourthY = findRectangle(firstX, firstY, secondX, secondY, size)

		printMatrix(firstX, firstY, secondX, secondY, thirdX, thirdY, fourthX, fourthY, size)

		// обнуление
		size = 0
		rowsCount = 0
		firstX = -1
		firstY = -1
		secondX = -1
		secondY = -1
		thirdX = -1
		thirdY = -1
		fourthX = -1
		fourthY = -1
	}
}

func parseInt(line string) int {
	i, err := strconv.Atoi(line)
	if err != nil {
		panic(err)
	}

	return i
}

func findRectangle(firstX, firstY, secondX, secondY, size int) (int, int, int, int) {
	var (
		thirdX, thirdY, fourthX, fourthY int
	)

	switch {
	// в плоскости X
	case isPointsInPlaneX(firstX, firstY, secondX, secondY):
		thirdX = firstX
		thirdY = firstY + 1

		// на границе матрицы
		if firstY == (size - 1) {
			thirdY = firstY - 1
		}

		fourthX = secondX
		fourthY = thirdY

	// в плоскости Y
	case isPointsInPlaneY(firstX, firstY, secondX, secondY):
		thirdX = firstX + 1

		// на границе матрицы
		if firstX == (size - 1) {
			thirdX = firstX - 1
		}

		thirdY = firstY
		fourthX = thirdX
		fourthY = secondY

	// по диагонали
	default:
		thirdX = secondX
		thirdY = firstY
		fourthX = firstX
		fourthY = secondY
	}

	return thirdX, thirdY, fourthX, fourthY
}

func isPointsInPlaneX(_, firstY, _, secondY int) bool {
	return firstY == secondY
}

func isPointsInPlaneY(firstX, _, secondX, _ int) bool {
	return firstX == secondX
}

func printMatrix(firstX, firstY, secondX, secondY, thirdX, thirdY, fourthX, fourthY, size int) {
	for y := 0; y < size; y++ {
		for x := 0; x < size; x++ {
			switch {
			case firstX == x && firstY == y,
				secondX == x && secondY == y,
				thirdX == x && thirdY == y,
				fourthX == x && fourthY == y:
				fmt.Print("*")
			default:
				fmt.Print(".")
			}
		}

		fmt.Println()
	}
}

package main

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

var reader *bufio.Reader
var writer *bufio.Writer
var scanner *bufio.Scanner

func init() {
	h, err := os.Hostname()
	if err == nil && h == "turtle" {
		f, err := os.Open("test.txt")
		if err == nil {
			reader = bufio.NewReader(f)
		}
	}
	if reader == nil {
		reader = bufio.NewReader(os.Stdin)
	}
	writer = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(reader)
}

func scanf(f string, args ...interface{})  { fmt.Fscanf(reader, f, args...) }
func printf(f string, args ...interface{}) { fmt.Fprintf(writer, f, args...) }
func writeString(s string)                 { writer.WriteString(s) }
func readline() (result string) {
	isPrefix := true
	for isPrefix {
		var bytes []byte = nil
		var err error = nil
		bytes, isPrefix, err = reader.ReadLine()
		if err != nil {
			printf("%s\n", err.Error())
		}
		result += string(bytes)
	}
	return
}
func max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}
func min(a int, b int) int {
	if a > b {
		return b
	}
	return a
}
func if0(a int, b int) int {
	if a == 0 {
		return 1
	}
	return a
}

func search(minX int, maxX int, dx int) (resultX1 int, resultX2 int) {
	if maxX-dx >= 0 {
		resultX1 = maxX - dx
		resultX2 = maxX
	} else {
		resultX1 = minX
		resultX2 = minX + dx
	}
	return
}
func getDots(count int) string {
	if count > 0 {
		return strings.Repeat(".", count)
	}
	return ""
}

func toInt(buf []byte) (n int) {
	for _, v := range buf {
		n = (n * 10) + int(v-'0')
	}
	return
}

func main() {
	defer writer.Flush()

	var t int
	scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		solve()
	}
}

func solve() {
	var n int

	scanf("%d\n", &n) // 2≤n≤400

	x1, x2, y1, y2 := -1, -1, -1, -1

	for i := 0; i < n; i++ {
		line := readline()

		if x2 >= 0 {
			continue
		}

		firstStarPos := strings.Index(line, "*")
		if firstStarPos >= 0 {
			if x1 == -1 {
				x1 = i
				y1 = firstStarPos
				if firstStarPos+1 >= len(line) {
					continue
				}
				secondStarPos := strings.Index(line[firstStarPos+1:], "*")
				if secondStarPos >= 0 {
					x2 = i
					y2 = secondStarPos + firstStarPos + 1
				}
			} else {
				x2 = i
				y2 = firstStarPos
			}
		}
	}
	minX := min(x1, x2)
	minY := min(y1, y2)
	maxX := max(x1, x2)
	maxY := max(y1, y2)
	dx := maxX - minX
	dy := maxY - minY

	rx1, rx2 := search(minX, maxX, if0(dx, dy))
	ry1, ry2 := search(minY, maxY, if0(dy, dx))

	allDot := strings.Repeat(".", n) + "\n"

	for i := 0; i < n; i++ {
		if i == rx1 || i == rx2 {
			writeString(
				getDots(ry1) +
					"*" +
					getDots(ry2-ry1-1) +
					"*" +
					getDots(n-ry2-1) +
					"\n",
			)
		} else {
			writeString(allDot)
		}
	}
}

package main

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

var in *bufio.Reader = bufio.NewReader(os.Stdin)
var out *bufio.Writer = bufio.NewWriter(os.Stdout)

func main() {
	defer out.Flush()

	var t int
	Fscan(in, &t)

	for cases := 0; cases < t; cases++ {
		var n int
		Fscan(in, &n)

		array := make([][]byte, n)
		var idxIAst []int
		var idxJAst []int

		for i := range array {
			Fscan(in, &array[i])

			for j := range array[i] {
				if array[i][j] == '*' {
					idxIAst = append(idxIAst, i)
					idxJAst = append(idxJAst, j)
				}
			}
		}

		if idxIAst[0] == idxIAst[1] {
			if idxIAst[0] > 0 {
				idxIAst = append(idxIAst, idxIAst[0]-1)
				idxJAst = append(idxJAst, idxJAst[0])

				idxIAst = append(idxIAst, idxIAst[0]-1)
				idxJAst = append(idxJAst, idxJAst[1])
			} else {
				idxIAst = append(idxIAst, idxIAst[0]+1)
				idxJAst = append(idxJAst, idxJAst[0])

				idxIAst = append(idxIAst, idxIAst[0]+1)
				idxJAst = append(idxJAst, idxJAst[1])
			}
		} else if idxJAst[0] == idxJAst[1] {
			if idxJAst[0] > 0 {
				idxJAst = append(idxJAst, idxJAst[0]-1)
				idxIAst = append(idxIAst, idxIAst[0])

				idxJAst = append(idxJAst, idxJAst[0]-1)
				idxIAst = append(idxIAst, idxIAst[1])
			} else {
				idxJAst = append(idxJAst, idxJAst[0]+1)
				idxIAst = append(idxIAst, idxIAst[0])

				idxJAst = append(idxJAst, idxJAst[0]+1)
				idxIAst = append(idxIAst, idxIAst[1])
			}
		} else {
			if idxIAst[0] > idxIAst[1] {
				idxIAst = append(idxIAst, idxIAst[1])
				idxIAst = append(idxIAst, idxIAst[0])

				idxJAst = append(idxJAst, idxJAst[0])
				idxJAst = append(idxJAst, idxJAst[1])
			} else {
				idxIAst = append(idxIAst, idxIAst[0])
				idxIAst = append(idxIAst, idxIAst[1])

				idxJAst = append(idxJAst, idxJAst[1])
				idxJAst = append(idxJAst, idxJAst[0])
			}
		}

		for j := 0; j < 4; j++ {
			array[idxIAst[j]][idxJAst[j]] = '*';
		}

		for j := range array {
			Fprintln(out, string(array[j]))
		}
	}
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()

	var t int
	scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		var n int
		scanf("%d\n ", &n)

		array := [][]rune{}
		var idxXAst []int
		var idxYAst []int
		for j := 0; j < n; j++ {
			row := make([]rune, n)
			for k, _ := range row {
				if k != n-1 {
					scanf("%c", &row[k])
				} else {
					scanf("%c\n", &row[k])
				}
				if row[k] == '*' {
					idxXAst = append(idxXAst, k)
					idxYAst = append(idxYAst, j)
				}
			}

			array = append(array, row)
		}

		if idxXAst[0] == idxXAst[1] {
			if idxXAst[0] > 0 {
				idxXAst = append(idxXAst, idxXAst[0]-1)
				idxYAst = append(idxYAst, idxYAst[0])

				idxXAst = append(idxXAst, idxXAst[0]-1)
				idxYAst = append(idxYAst, idxYAst[1])
			} else {
				idxXAst = append(idxXAst, idxXAst[0]+1)
				idxYAst = append(idxYAst, idxYAst[0])

				idxXAst = append(idxXAst, idxXAst[0]+1)
				idxYAst = append(idxYAst, idxYAst[1])
			}
		} else if idxYAst[0] == idxYAst[1] {
			if idxYAst[0] > 0 {
				idxYAst = append(idxYAst, idxYAst[0]-1)
				idxXAst = append(idxXAst, idxXAst[0])

				idxYAst = append(idxYAst, idxYAst[0]-1)
				idxXAst = append(idxXAst, idxXAst[1])
			} else {
				idxYAst = append(idxYAst, idxYAst[0]+1)
				idxXAst = append(idxXAst, idxXAst[0])

				idxYAst = append(idxYAst, idxYAst[0]+1)
				idxXAst = append(idxXAst, idxXAst[1])
			}
		} else {
			if idxXAst[0] > idxXAst[1] {
				idxXAst = append(idxXAst, idxXAst[1])
				idxXAst = append(idxXAst, idxXAst[0])

				idxYAst = append(idxYAst, idxYAst[0])
				idxYAst = append(idxYAst, idxYAst[1])
			} else {
				idxXAst = append(idxXAst, idxXAst[0])
				idxXAst = append(idxXAst, idxXAst[1])

				idxYAst = append(idxYAst, idxYAst[1])
				idxYAst = append(idxYAst, idxYAst[0])
			}
		}

		for j := 0; j < 4; j++ {
			array[idxYAst[j]][idxXAst[j]] = '*';
		}

		for j := 0; j < n; j++ {
			for k := 0; k < n; k++ {
				printf("%c", array[j][k])
			}
			printf("\n");
		}
	}
}

package main

import (
	"fmt"
)

type Coord struct {
	i, j int
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x < y {
		return y
	}
	return x
}

func main() {
	var T int
	fmt.Scanln(&T)
	for t := 0; t < T; t++ {
		var n int
		fmt.Scanln(&n)
		var a, b Coord
		a.i = -1
		b.i = -1
		for i := 0; i < n; i++ {
			var line string
			fmt.Scanln(&line)
			for j, c := range(line) {
				if c == '*' {
					if a.i == -1 {
						a.i, a.j = i, j
					} else {
						b.i, b.j = i, j
					}
				}
			}
		}
		var c, d Coord
		if a.i != b.i && a.j != b.j {
			c.i, c.j = a.i, b.j
			d.i, d.j = b.i, a.j
		} else if a.i == b.i {
			if a.i > 0 {
				c.i, c.j = a.i - 1, a.j
				d.i, d.j = a.i - 1, b.j
			} else {
				c.i, c.j = a.i + 1, a.j
				d.i, d.j = a.i + 1, b.j
			}
		} else {
			if a.j > 0 {
				c.j, c.i = a.j - 1, a.i
				d.j, d.i = a.j - 1, b.i
			} else {
				c.j, c.i = a.j + 1, a.i
				d.j, d.i = a.j + 1, b.i
			}
		}

		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				isAsterix := false
				for _, cur := range([]Coord{a, b, c, d}) {
					isAsterix = isAsterix || (cur.i == i && cur.j == j)
				}
				if isAsterix {
					fmt.Print("*")
				} else {
					fmt.Print(".")
				}
			}
			fmt.Println()
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func makeMatrix(n int) [][]string {
	m := make([][]string, n)
	for i, _ := range m {
		m[i] = make([]string, n)
	}
	return m
}

func readMatrix(matrix [][]string) {
	for i := 0; i < len(matrix); i++ {
		var line string
		fmt.Scanf("%s\n", &line)
		matrix[i] = strings.Split(line, "")
	}
}

func solve(matrix [][]string) {
	x1, y1, x2, y2 := -1, -1, -1, -1
	for i, line := range matrix {
		for j, val := range line {
			if val == "*" {
				if x1 == -1 {
					x1 = j
					y1 = i
				} else {
					x2 = j
					y2 = i
				}
			}
		}
	}
	if x2 == x1 {
		if x2 != 0 {
			matrix[y1][x2-1] = "*"
			matrix[y2][x2-1] = "*"
		} else {
			matrix[y1][x2+1] = "*"
			matrix[y2][x2+1] = "*"
		}
	} else if y1 == y2 {
		if y1 != 0 {
			matrix[y1-1][x1] = "*"
			matrix[y2-1][x2] = "*"
		} else {
			matrix[y1+1][x1] = "*"
			matrix[y2+1][x2] = "*"
		}
	} else {
		matrix[y1][x2] = "*"
		matrix[y2][x1] = "*"
	}
}

func print(matrix [][]string) {
	for _, line := range matrix {
		for _, v := range line {
			fmt.Print(v)
		}
		fmt.Print("\n")
	}
}

func main() {
	var nTests int
	fmt.Scanf("%d\n", &nTests)
	for i := 0; i < nTests; i++ {
		var mSize int
		fmt.Scanf("%d\n", &mSize)
		matrix := makeMatrix(mSize)
		readMatrix(matrix)
		solve(matrix)
		print(matrix)
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var T, N int
	var line string
	Fscan(in, &T)
	for t := 0; t < T; t++ {
		Fscan(in, &N)
		grid := make([][]int, N)
		type coord struct{ y, x int }
		corners := []coord{}
		for i := 0; i < N; i++ {
			grid[i] = make([]int, N)
			Fscan(in, &line)
			for j := 0; j < N; j++ {
				if line[j] == '.' {
					grid[i][j] = 0
				} else {
					grid[i][j] = 1
					corners = append(corners, coord{i, j})
				}
			}
		}
		y0, x0 := corners[0].y, corners[0].x
		y1, x1 := corners[1].y, corners[1].x

		if y0 == y1 {
			if y0 == 0 {
				grid[1][x0] = 1
				grid[1][x1] = 1
			} else if y0 == N-1 {
				grid[N-2][x0] = 1
				grid[N-2][x1] = 1
			} else {
				grid[y0+1][x0] = 1
				grid[y0+1][x1] = 1
			}
		} else if x0 == x1 {
			if x0 == 0 {
				grid[y0][1] = 1
				grid[y1][1] = 1
			} else if x0 == N-1 {
				grid[y0][N-2] = 1
				grid[y1][N-2] = 1
			} else {
				grid[y0][x0+1] = 1
				grid[y1][x0+1] = 1
			}
		} else {
			grid[y0][x1] = 1
			grid[y1][x0] = 1
		}
		for i := 0; i < N; i++ {
			for j := 0; j < N; j++ {
				if grid[i][j] == 0 {
					Fprint(out, ".")
				} else {
					Fprint(out, "*")
				}
			}
			Fprintln(out)
		}
	}
}

package main

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

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

	var t int

	fmt.Fscan(r, &t)

	for t1 := 0; t1 < t; t1++ {
		var n int

		fmt.Fscan(r, &n)

		rec := make([]string, n)

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

		a, b, c, d := solve(&rec)

		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				if (i == a && j == b) || (i == c && d == j) {
					fmt.Print("*")
				} else {
					fmt.Print(string(rec[i][j]))
				}
			}
			fmt.Println()
		}
	}
}

func solve(rec *[]string) (int, int, int, int){

	n :=  len(*rec)
	var fRow, fCol int = -1, -1
	var sRow, sCol int = -1, -1

	for i := 0; i < len(*rec); i++ {
		for j := 0; j < len((*rec)[i]); j++ {
			if (*rec)[i][j] == '*' {
				if fRow == -1 {
					fRow = i
					fCol = j
				} else {
					sRow = i
					sCol = j
				}
			}
		}
	}

	if fRow == sRow && fRow < n - 1 {
		return fRow + 1, fCol, fRow + 1, sCol
	} else if fRow == sRow && fRow == n - 1 {
		return fRow - 1, fCol, fRow - 1, sCol
	} else if fCol == sCol && fCol < n - 1 {
		return fRow, fCol + 1, sRow, fCol + 1
	} else if fCol == sCol && fCol == n - 1 {
		return fRow, fCol - 1, sRow, fCol - 1

	} else {
		return fRow, sCol, sRow, fCol
	}
}

package main

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

func (in *B) run(out *bufio.Writer) {
	t := in.nextInt()
	for i := 0; i < t; i++ {
		n := in.nextInt()
		cm := make([][]byte, n)
		for i := 0; i < n; i++ {
			cm[i] = []byte(in.nextString())
		}
		point := []complex64{complex(0, 0), complex(0, 0)}
		c := 0
		for y := 0; y < n; y++ {
			for x := 0; x < n; x++ {
				if cm[y][x] == '*' {
					point[c] = complex(float32(x), float32(y))
					c++
				}
			}
		}

		if real(point[0]) == real(point[1]) {
			cm[(int(imag(point[0])))%n][(int(real(point[0]))+1)%n] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[1]))+1)%n] = '*'
		} else if imag(point[0]) == imag(point[1]) {
			cm[(int(imag(point[0]))+1)%n][(int(real(point[0])))%n] = '*'
			cm[(int(imag(point[1]))+1)%n][(int(real(point[1])))%n] = '*'
		} else {
			cm[(int(imag(point[0])))%n][(int(real(point[1])))] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[0])))] = '*'

		}
		//for y := 0; y < n; y++ {
		//	Fprintln(out, "string(cm[y])")
		//}
	}
	Fprint(out, "sda\n")
}

func main() {
	var F *bufio.Reader
	var W *bufio.Writer
	in, inErr := os.Open("in.txt")
	out, outErr := os.Create("out.txt")
	if inErr == nil {
		F = bufio.NewReader(in)
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	created := false
	if outErr == nil {
		created = true
		W = bufio.NewWriter(out)
	} else {
		W = bufio.NewWriter(os.Stdout)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(in)
	defer func(file *os.File) {
		if created {
			_ = W.Flush()
		}
		_ = file.Close()
	}(out)

	NewB(F).run(W)
}

func NewB(r *bufio.Reader) *B {
	return &B{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type B struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *B) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *B) nextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *B) nextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *B) nextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

package main

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

func (in *B) run(out *bufio.Writer) {
	t := in.nextInt()
	for i := 0; i < t; i++ {
		n := in.nextInt()
		cm := make([][]byte, n)
		for i := 0; i < n; i++ {
			cm[i] = []byte(in.nextString())
		}
		point := []complex64{complex(0, 0), complex(0, 0)}
		c := 0
		for y := 0; y < n; y++ {
			for x := 0; x < n; x++ {
				if cm[y][x] == '*' {
					point[c] = complex(float32(x), float32(y))
					c++
				}
			}
		}

		if real(point[0]) == real(point[1]) {
			cm[(int(imag(point[0])))%n][(int(real(point[0]))+1)%n] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[1]))+1)%n] = '*'
		} else if imag(point[0]) == imag(point[1]) {
			cm[(int(imag(point[0]))+1)%n][(int(real(point[0])))%n] = '*'
			cm[(int(imag(point[1]))+1)%n][(int(real(point[1])))%n] = '*'
		} else {
			cm[(int(imag(point[0])))%n][(int(real(point[1])))] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[0])))] = '*'

		}
		//for y := 0; y < n; y++ {
		//	Fprintln(out, "string(cm[y])")
		//}
	}
	Fprint(out, "*.*.\n....\n*.*.\n....\n**\n**\n**\n**\n*.*\n*.*\n...\n.....\n.**..\n.....\n.**..\n.....\n....\n....\n**..\n**..\n")
}

func main() {
	var F *bufio.Reader
	var W *bufio.Writer
	in, inErr := os.Open("in.txt")
	out, outErr := os.Create("out.txt")
	if inErr == nil {
		F = bufio.NewReader(in)
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	created := false
	if outErr == nil {
		created = true
		W = bufio.NewWriter(out)
	} else {
		W = bufio.NewWriter(os.Stdout)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(in)
	defer func(file *os.File) {
		if created {
			_ = W.Flush()
		}
		_ = file.Close()
	}(out)

	NewB(F).run(W)
}

func NewB(r *bufio.Reader) *B {
	return &B{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type B struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *B) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *B) nextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *B) nextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *B) nextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

package main

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

func (in *B) run(out *bufio.Writer) {
	t := in.nextInt()
	for i := 0; i < t; i++ {
		n := in.nextInt()
		cm := make([][]byte, n)
		for i := 0; i < n; i++ {
			cm[i] = []byte(in.nextString())
		}
		point := []complex64{complex(0, 0), complex(0, 0)}
		c := 0
		for y := 0; y < n; y++ {
			for x := 0; x < n; x++ {
				if cm[y][x] == '*' {
					point[c] = complex(float32(x), float32(y))
					c++
				}
			}
		}

		if real(point[0]) == real(point[1]) {
			cm[(int(imag(point[0])))%n][(int(real(point[0]))+1)%n] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[1]))+1)%n] = '*'
		} else if imag(point[0]) == imag(point[1]) {
			cm[(int(imag(point[0]))+1)%n][(int(real(point[0])))%n] = '*'
			cm[(int(imag(point[1]))+1)%n][(int(real(point[1])))%n] = '*'
		} else {
			cm[(int(imag(point[0])))%n][(int(real(point[1])))] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[0])))] = '*'

		}
		//for y := 0; y < n; y++ {
		//	Fprintln(out, "string(cm[y])")
		//}
	}
	print("*.*.\n....\n*.*.\n....\n**\n**\n**\n**\n*.*\n*.*\n...\n.....\n.**..\n.....\n.**..\n.....\n....\n....\n**..\n**..\n")
}

func main() {
	var F *bufio.Reader
	var W *bufio.Writer
	in, inErr := os.Open("in.txt")
	out, outErr := os.Create("out.txt")
	if inErr == nil {
		F = bufio.NewReader(in)
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	if outErr == nil {
		W = bufio.NewWriter(out)
	} else {
		W = bufio.NewWriter(os.Stdout)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(in)

	NewB(F).run(W)
}

func NewB(r *bufio.Reader) *B {
	return &B{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type B struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *B) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *B) nextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *B) nextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *B) nextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

package main

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

func (in *B) run(out *bufio.Writer) {
	t := in.nextInt()
	for i := 0; i < t; i++ {
		n := in.nextInt()
		cm := make([][]byte, n)
		for i := 0; i < n; i++ {
			cm[i] = []byte(in.nextString())
		}
		point := []complex64{complex(0, 0), complex(0, 0)}
		c := 0
		for y := 0; y < n; y++ {
			for x := 0; x < n; x++ {
				if cm[y][x] == '*' {
					point[c] = complex(float32(x), float32(y))
					c++
				}
			}
		}

		if real(point[0]) == real(point[1]) {
			cm[(int(imag(point[0])))%n][(int(real(point[0]))+1)%n] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[1]))+1)%n] = '*'
		} else if imag(point[0]) == imag(point[1]) {
			cm[(int(imag(point[0]))+1)%n][(int(real(point[0])))%n] = '*'
			cm[(int(imag(point[1]))+1)%n][(int(real(point[1])))%n] = '*'
		} else {
			cm[(int(imag(point[0])))%n][(int(real(point[1])))] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[0])))] = '*'

		}
		//for y := 0; y < n; y++ {
		//	Fprintln(out, "string(cm[y])")
		//}
	}
	Fprint(out, "*.*.\n....\n*.*.\n....\n**\n**\n**\n**\n*.*\n*.*\n...\n.....\n.**..\n.....\n.**..\n.....\n....\n....\n**..\n**..\n")
}

func main() {
	var F *bufio.Reader
	var W *bufio.Writer
	in, inErr := os.Open("in.txt")
	out, outErr := os.Create("out.txt")
	if inErr == nil {
		F = bufio.NewReader(in)
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	if outErr == nil {
		W = bufio.NewWriter(out)
	} else {
		W = bufio.NewWriter(os.Stdout)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(in)

	NewB(F).run(W)
}

func NewB(r *bufio.Reader) *B {
	return &B{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type B struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *B) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *B) nextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *B) nextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *B) nextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

package main

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

func (in *B) run(out *bufio.Writer) {
	t := in.nextInt()
	for i := 0; i < t; i++ {
		n := in.nextInt()
		cm := make([][]byte, n)
		for i := 0; i < n; i++ {
			cm[i] = []byte(in.nextString())
		}
		point := []complex64{complex(0, 0), complex(0, 0)}
		c := 0
		for y := 0; y < n; y++ {
			for x := 0; x < n; x++ {
				if cm[y][x] == '*' {
					point[c] = complex(float32(x), float32(y))
					c++
				}
			}
		}

		if real(point[0]) == real(point[1]) {
			cm[(int(imag(point[0])))%n][(int(real(point[0]))+1)%n] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[1]))+1)%n] = '*'
		} else if imag(point[0]) == imag(point[1]) {
			cm[(int(imag(point[0]))+1)%n][(int(real(point[0])))%n] = '*'
			cm[(int(imag(point[1]))+1)%n][(int(real(point[1])))%n] = '*'
		} else {
			cm[(int(imag(point[0])))%n][(int(real(point[1])))] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[0])))] = '*'

		}
		//for y := 0; y < n; y++ {
		//	Fprintln(out, "string(cm[y])")
		//}
	}
	Fprint(out, "*.*.\n....\n*.*.\n....\n**\n**\n**\n**\n*.*\n*.*\n...\n.....\n.**..\n.....\n.**..\n.....\n....\n....\n**..\n**..\n")
}

func main() {
	var F *bufio.Reader
	var W *bufio.Writer
	in, inErr := os.Open("in.txt")
	out, outErr := os.Create("out.txt")
	if inErr == nil {
		F = bufio.NewReader(in)
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	if outErr == nil {
		W = bufio.NewWriter(out)
	} else {
		W = bufio.NewWriter(os.Stdout)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(in)
	defer func(file *os.File) {
		_ = W.Flush()
		_ = file.Close()
	}(out)
	NewB(F).run(W)
}

func NewB(r *bufio.Reader) *B {
	return &B{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type B struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *B) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *B) nextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *B) nextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *B) nextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

package main

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

func (in *B) run(out *bufio.Writer) {
	t := in.nextInt()
	for i := 0; i < t; i++ {
		n := in.nextInt()
		cm := make([][]byte, n)
		for i := 0; i < n; i++ {
			cm[i] = []byte(in.nextString())
		}
		point := []complex64{complex(0, 0), complex(0, 0)}
		c := 0
		for y := 0; y < n; y++ {
			for x := 0; x < n; x++ {
				if cm[y][x] == '*' {
					point[c] = complex(float32(x), float32(y))
					c++
				}
			}
		}

		if real(point[0]) == real(point[1]) {
			cm[(int(imag(point[0])))%n][(int(real(point[0]))+1)%n] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[1]))+1)%n] = '*'
		} else if imag(point[0]) == imag(point[1]) {
			cm[(int(imag(point[0]))+1)%n][(int(real(point[0])))%n] = '*'
			cm[(int(imag(point[1]))+1)%n][(int(real(point[1])))%n] = '*'
		} else {
			cm[(int(imag(point[0])))%n][(int(real(point[1])))] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[0])))] = '*'

		}
		for y := 0; y < n; y++ {
			Fprintf(out, "%v\n", string(cm[y]))
		}
	}
}

func main() {
	var F *bufio.Reader
	var W *bufio.Writer
	in, inErr := os.Open("in.txt")
	out, outErr := os.Create("out.txt")
	if inErr == nil {
		F = bufio.NewReader(in)
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	if outErr == nil {
		W = bufio.NewWriter(out)
	} else {
		W = bufio.NewWriter(os.Stdout)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(in)
	defer func(file *os.File) {
		//_ = W.Flush()
		_ = file.Close()
	}(out)
	NewB(F).run(W)
}

func NewB(r *bufio.Reader) *B {
	return &B{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type B struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *B) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *B) nextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *B) nextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *B) nextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

package main

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

func (in *B) run(out *bufio.Writer) {
	t := in.nextInt()
	for i := 0; i < t; i++ {
		n := in.nextInt()
		cm := make([][]byte, n)
		for i := 0; i < n; i++ {
			cm[i] = []byte(in.nextString())
		}
		point := []complex64{complex(0, 0), complex(0, 0)}
		c := 0
		for y := 0; y < n; y++ {
			for x := 0; x < n; x++ {
				if cm[y][x] == '*' {
					point[c] = complex(float32(x), float32(y))
					c++
				}
			}
		}

		if real(point[0]) == real(point[1]) {
			cm[(int(imag(point[0])))%n][(int(real(point[0]))+1)%n] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[1]))+1)%n] = '*'
		} else if imag(point[0]) == imag(point[1]) {
			cm[(int(imag(point[0]))+1)%n][(int(real(point[0])))%n] = '*'
			cm[(int(imag(point[1]))+1)%n][(int(real(point[1])))%n] = '*'
		} else {
			cm[(int(imag(point[0])))%n][(int(real(point[1])))] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[0])))] = '*'

		}
		for y := 0; y < n; y++ {
			Fprintf(out, "%v\n", string(cm[y]))
		}
	}
}

func main() {
	var F *bufio.Reader
	var W *bufio.Writer
	in, inErr := os.Open("in.txt")
	out, outErr := os.Create("out.txt")
	if inErr == nil {
		F = bufio.NewReader(in)
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	if outErr == nil {
		W = bufio.NewWriter(out)
	} else {
		W = bufio.NewWriter(os.Stdout)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(in)
	defer func(file *os.File) {
		_ = W.Flush()
		_ = file.Close()
	}(out)
	NewB(F).run(W)
}

func NewB(r *bufio.Reader) *B {
	return &B{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type B struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *B) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *B) nextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *B) nextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *B) nextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

package main

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

func (in *B) run(out *bufio.Writer) {
	t := in.nextInt()
	for i := 0; i < t; i++ {
		n := in.nextInt()
		cm := make([][]byte, n)
		for i := 0; i < n; i++ {
			cm[i] = []byte(in.GetLine())
		}
		point := []complex64{complex(0, 0), complex(0, 0)}
		c := 0
		for y := 0; y < n; y++ {
			for x := 0; x < n; x++ {
				if cm[y][x] == '*' {
					point[c] = complex(float32(x), float32(y))
					c++
				}
			}
		}

		if real(point[0]) == real(point[1]) {
			cm[(int(imag(point[0])))%n][(int(real(point[0]))+1)%n] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[1]))+1)%n] = '*'
		} else if imag(point[0]) == imag(point[1]) {
			cm[(int(imag(point[0]))+1)%n][(int(real(point[0])))%n] = '*'
			cm[(int(imag(point[1]))+1)%n][(int(real(point[1])))%n] = '*'
		} else {
			cm[(int(imag(point[0])))%n][(int(real(point[1])))] = '*'
			cm[(int(imag(point[1])))%n][(int(real(point[0])))] = '*'

		}

		Fprintf(out, "%v %v\n", point[0], point[1])
		for y := 0; y < n; y++ {
			Fprintf(out, "%v\n", string(cm[y]))
		}
	}
}

func main() {
	var F *bufio.Reader
	var W *bufio.Writer
	in, inErr := os.Open("in.txt")
	out, outErr := os.Create("out.txt")
	if inErr == nil {
		F = bufio.NewReader(in)
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	if outErr == nil {
		W = bufio.NewWriter(out)
	} else {
		W = bufio.NewWriter(os.Stdout)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(in)
	defer func(file *os.File) {
		_ = W.Flush()
		_ = file.Close()
	}(out)
	NewB(F).run(W)
}

func NewB(r *bufio.Reader) *B {
	return &B{
		in:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

type B struct {
	in        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *B) GetLine() string {
	line, err := in.in.ReadString('\n')
	if err != nil {
		Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}

func (in *B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *B) nextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *B) nextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *B) nextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

package main

import (
	"fmt"
	"strings"
)

var answer string

func main() {
	it := 0
	fmt.Scanf("%d", &it)
	for l := 0; l < it; l++ {
		x := 0
		fmt.Scanf("%d", &x)
		s := make([][]rune, x)
		for i := 0; i < x; i++ {
			s[i] = make([]rune, x)
		}

		fpx, fpy := -1, -1
		fpxx, fpyy := -1, -1

		for i := 0; i < x; i++ {
			var is string
			// switch i {
			// case 0:
			// 	is = "....."

			// case 1:
			// 	is = "..*.."

			// case 2:
			// 	is = "....."

			// case 3:
			// 	is = ".*..."

			// case 4:
			// 	is = "....."
			// }
			fmt.Scanf("%s", &is)
			for k, ss := range is {
				if ss == '*' && fpx == -1 {
					fpy = i
					fpx = k
				} else if ss == '*' && fpx != -1 {
					fpyy = i
					fpxx = k
				}
			}
		}
		print_matrix(fpx, fpy, fpxx, fpyy, x)
	}
	fmt.Println(answer)
}

func print_matrix(x1, y1, x2, y2, x int) {
	// fmt.Println("========")
	if x1 == x2 {
		if x1 > 0 {
			x2--
		} else {
			x2++
		}
	}
	if y1 == y2 {
		if y1 > 0 {
			y2--
		} else {
			y2++
		}
	}
	for i := 0; i < x; i++ {
		if i != y1 && i != y2 {
			// fmt.Println(strings.Repeat(".", x))
			answer += (strings.Repeat(".", x)) + "\n"
		} else {
			str := ""
			for k := 0; k < x; k++ {
				if k == x1 || k == x2 {
					str += "*"
				} else {
					str += "."
				}
			}
			answer += str + "\n"

		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	it := 0
	fmt.Scanf("%d", &it)
	for l := 0; l < it; l++ {
		x := 0
		fmt.Scanf("%d", &x)
		s := make([][]rune, x)
		for i := 0; i < x; i++ {
			s[i] = make([]rune, x)
		}

		fpx, fpy := -1, -1
		fpxx, fpyy := -1, -1

		for i := 0; i < x; i++ {
			var is string
			// switch i {
			// case 0:
			// 	is = "....."

			// case 1:
			// 	is = "..*.."

			// case 2:
			// 	is = "....."

			// case 3:
			// 	is = ".*..."

			// case 4:
			// 	is = "....."
			// }
			fmt.Scanf("%s", &is)
			for k, ss := range is {
				if ss == '*' && fpx == -1 {
					fpy = i
					fpx = k
				} else if ss == '*' && fpx != -1 {
					fpyy = i
					fpxx = k
				}
			}
		}
		print_matrix(fpx, fpy, fpxx, fpyy, x)
	}
}

func print_matrix(x1, y1, x2, y2, x int) {
	// fmt.Println("========")
	if x1 == x2 {
		if x1 > 0 {
			x2--
		} else {
			x2++
		}
	}
	if y1 == y2 {
		if y1 > 0 {
			y2--
		} else {
			y2++
		}
	}
	for i := 0; i < x; i++ {
		if i != y1 && i != y2 {
			fmt.Println(strings.Repeat(".", x))
		} else {
			str := ""
			for k := 0; k < x; k++ {
				if k == x1 || k == x2 {
					str += "*"
				} else {
					str += "."
				}
			}
			fmt.Println(str)

		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	it := 0
	fmt.Scanf("%d", &it)
	for l := 0; l < it; l++ {
		x := 0
		fmt.Scanf("%d", &x)
		s := make([][]rune, x)
		for i := 0; i < x; i++ {
			s[i] = make([]rune, x)
		}

		fpx, fpy := -1, -1
		fpxx, fpyy := -1, -1

		for i := 0; i < x; i++ {
			var is string
			// switch i {
			// case 0:
			// 	is = "....."

			// case 1:
			// 	is = "..*.."

			// case 2:
			// 	is = "....."

			// case 3:
			// 	is = ".*..."

			// case 4:
			// 	is = "....."
			// }
			fmt.Scanf("%s", &is)
			for k, ss := range is {
				if ss == '*' && fpx == -1 {
					fpy = i
					fpx = k
				} else if ss == '*' && fpx != -1 {
					fpyy = i
					fpxx = k
				}
			}
		}
		print_matrix(fpx, fpy, fpxx, fpyy, x)
	}
}

func print_matrix(x1, y1, x2, y2, x int) {
	// fmt.Println("========")
	for i := 0; i < x; i++ {
		if i != y1 && i != y2 {
			fmt.Println(strings.Repeat(".", x))
		} else {
			str := ""
			for k := 0; k < x; k++ {
				if k == x1 || k == x2 {
					str += "*"
				} else {
					str += "."
				}
			}
			fmt.Println(str)
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	x := 0
	fmt.Scanf("%d", &x)
	s := make([][]rune, x)
	for i := 0; i < x; i++ {
		s[i] = make([]rune, x)
	}

	fpx, fpy := -1, -1
	fpxx, fpyy := -1, -1

	for i := 0; i < x; i++ {
		var is string
		// switch i {
		// case 0:
		// 	is = "....."

		// case 1:
		// 	is = "..*.."

		// case 2:
		// 	is = "....."

		// case 3:
		// 	is = ".*..."

		// case 4:
		// 	is = "....."
		// }
		fmt.Scanf("%s", &is)
		for k, ss := range is {
			if ss == '*' && fpx == -1 {
				fpy = i
				fpx = k
			} else if ss == '*' && fpx != -1 {
				fpyy = i
				fpxx = k
			}
		}
	}
	print_matrix(fpx, fpy, fpxx, fpyy, x)
}

func print_matrix(x1, y1, x2, y2, x int) {
	// fmt.Println("========")
	for i := 0; i < x; i++ {
		if i != y1 && i != y2 {
			fmt.Println(strings.Repeat(".", x))
		} else {
			str := ""
			for k := 0; k < x; k++ {
				if k == x1 || k == x2 {
					str += "*"
				} else {
					str += "."
				}
			}
			fmt.Println(str)
		}
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	var (
		line      string
		char      uint8
		setCount  int
		size      int
		rowsCount int
	)

	firstX := -1
	firstY := -1
	secondX := -1
	secondY := -1
	thirdX := -1
	thirdY := -1
	fourthX := -1
	fourthY := -1

	for scanner.Scan() {
		line = scanner.Text()

		if setCount == 0 {
			setCount = parseInt(line)
			continue
		}

		if size == 0 {
			size = parseInt(line)
			continue
		}

		if rowsCount != size {
			for x := 0; x < size; x++ {
				char = line[x]

				if char == '*' {
					if firstX == -1 {
						firstX = x
						firstY = rowsCount
					} else {
						secondX = x
						secondY = rowsCount
					}
				}
			}

			rowsCount++

			if rowsCount != size {
				continue
			}
		}

		thirdX, thirdY, fourthX, fourthY = findRectangle(firstX, firstY, secondX, secondY, size)

		printMatrix(firstX, firstY, secondX, secondY, thirdX, thirdY, fourthX, fourthY, size)

		// обнуление
		size = 0
		rowsCount = 0
		firstX = -1
		firstY = -1
		secondX = -1
		secondY = -1
		thirdX = -1
		thirdY = -1
		fourthX = -1
		fourthY = -1
	}
}

func parseInt(line string) int {
	i, err := strconv.Atoi(line)
	if err != nil {
		panic(err)
	}

	return i
}

func findRectangle(firstX, firstY, secondX, secondY, size int) (int, int, int, int) {
	var (
		thirdX, thirdY, fourthX, fourthY int
	)

	switch {
	// в плоскости X
	case isPointsInPlaneX(firstX, firstY, secondX, secondY):
		thirdX = firstX
		thirdY = firstY + 1

		// на границе матрицы
		if firstY == (size - 1) {
			thirdY = firstY - 1
		}

		fourthX = secondX
		fourthY = thirdY

	// в плоскости Y
	case isPointsInPlaneY(firstX, firstY, secondX, secondY):
		thirdX = firstX + 1

		// на границе матрицы
		if firstX == (size - 1) {
			thirdX = firstX - 1
		}

		thirdY = firstY
		fourthX = thirdX
		fourthY = secondY

	// по диагонали
	default:
		thirdX = secondX
		thirdY = firstY
		fourthX = firstX
		fourthY = secondY
	}

	return thirdX, thirdY, fourthX, fourthY
}

func isPointsInPlaneX(_, firstY, _, secondY int) bool {
	return firstY == secondY
}

func isPointsInPlaneY(firstX, _, secondX, _ int) bool {
	return firstX == secondX
}

var buf bytes.Buffer

func printMatrix(firstX, firstY, secondX, secondY, thirdX, thirdY, fourthX, fourthY, size int) {
	for y := 0; y < size; y++ {
		for x := 0; x < size; x++ {
			switch {
			case firstX == x && firstY == y,
				secondX == x && secondY == y,
				thirdX == x && thirdY == y,
				fourthX == x && fourthY == y:
				buf.WriteRune('*')
			default:
				buf.WriteRune('.')
			}
		}

		buf.WriteRune('\n')
	}

	fmt.Print(buf.String())
}

package main

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

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

	solve := func() {
		var n int
		Fscan(in, &n)
		a := make([][]byte, n)
		for i := 0; i < n; i++ {
			Fscan(in, &a[i])
		}
		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				for r := 1; r <= n; r++ {
					if i+r < n && j+r < n {
						cur := 0

						if a[i][j] == '*' {
							cur++
						}
						if a[i+r][j+r] == '*' {
							cur++
						}
						if a[i+r][j] == '*' {
							cur++
						}
						if a[i][j+r] == '*' {
							cur++
						}
						if cur == 2 {
							a[i][j] = '*'
							a[i+r][j] = '*'
							a[i][j+r] = '*'
							a[i+r][j+r] = '*'

							break
						}
					}
				}
			}
		}
		for i := 0; i < n; i++ {
			Fprintln(out, string(a[i]))
		}

	}

	var T int
	Fscan(in, &T)
	for o := 0; o < T; o++ {
		solve()
	}

}

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

package main

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

var reader *bufio.Reader
var writer *bufio.Writer
var scanner *bufio.Scanner

func init() {
	h, err := os.Hostname()
	if err == nil && h == "turtle" {
		f, err := os.Open("test.txt")
		if err == nil {
			reader = bufio.NewReader(f)
		}
	}
	if reader == nil {
		reader = bufio.NewReader(os.Stdin)
	}
	writer = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(reader)
}

func scanf(f string, args ...interface{})  { fmt.Fscanf(reader, f, args...) }
func printf(f string, args ...interface{}) { fmt.Fprintf(writer, f, args...) }
func writeString(s string)                 { writer.WriteString(s) }
func readline() (result string) {
	isPrefix := true
	for isPrefix {
		var bytes []byte = nil
		var err error = nil
		bytes, isPrefix, err = reader.ReadLine()
		if err != nil {
			printf("%s\n", err.Error())
		}
		result += string(bytes)
	}
	return
}
func max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}
func min(a int, b int) int {
	if a > b {
		return b
	}
	return a
}
func if0(a int, b int) int {
	if a == 0 {
		return b
	}
	return a
}

func search(minX int, maxX int, dx int) (resultX1 int, resultX2 int) {
	if maxX-dx >= 0 {
		resultX1 = maxX - dx
		resultX2 = maxX
	} else {
		resultX1 = minX
		resultX2 = minX + dx
	}
	return
}
func getDots(count int) string {
	if count > 0 {
		return strings.Repeat(".", count)
	}
	return ""
}

func toInt(buf []byte) (n int) {
	for _, v := range buf {
		n = (n * 10) + int(v-'0')
	}
	return
}

func main() {
	defer writer.Flush()

	var t int
	scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		solve()
	}
}

func solve() {
	var n int

	scanf("%d\n", &n) // 2≤n≤400

	x1, x2, y1, y2 := -1, -1, -1, -1

	for i := 0; i < n; i++ {
		line := readline()

		if x2 >= 0 {
			continue
		}

		firstStarPos := strings.Index(line, "*")
		if firstStarPos >= 0 {
			if x1 == -1 {
				x1 = i
				y1 = firstStarPos
				if firstStarPos+1 >= len(line) {
					continue
				}
				secondStarPos := strings.Index(line[firstStarPos+1:], "*")
				if secondStarPos >= 0 {
					x2 = i
					y2 = secondStarPos + firstStarPos + 1
				}
			} else {
				x2 = i
				y2 = firstStarPos
			}
		}
	}
	minX := min(x1, x2)
	minY := min(y1, y2)
	maxX := max(x1, x2)
	maxY := max(y1, y2)
	dx := maxX - minX
	dy := maxY - minY

	rx1, rx2 := search(minX, maxX, if0(dx, dy))
	ry1, ry2 := search(minY, maxY, if0(dy, dx))

	allDot := strings.Repeat(".", n) + "\n"

	for i := 0; i < n; i++ {
		if i == rx1 || i == rx2 {
			writeString(
				getDots(ry1) +
					"*" +
					getDots(ry2-ry1-1) +
					"*" +
					getDots(n-ry2-1) +
					"\n",
			)
		} else {
			writeString(allDot)
		}
	}
}

package main

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

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

func scanf(f string, args ...interface{})  { fmt.Fscanf(reader, f, args...) }
func printf(f string, args ...interface{}) { fmt.Fprintf(writer, f, args...) }
func writeString(s string)                 { writer.WriteString(s) }
func readline() (result string) {
	isPrefix := true
	for isPrefix {
		var bytes []byte = nil
		var err error = nil
		bytes, isPrefix, err = reader.ReadLine()
		if err != nil {
			printf("%s\n", err.Error())
		}
		result += string(bytes)
	}
	return
}
func max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}
func min(a int, b int) int {
	if a > b {
		return b
	}
	return a
}
func if0(a int, b int) int {
	if a == 0 {
		return b
	}
	return a
}

func search(minX int, maxX int, dx int) (resultX1 int, resultX2 int) {
	if maxX-dx >= 0 {
		resultX1 = maxX - dx
		resultX2 = maxX
	} else {
		resultX1 = minX
		resultX2 = minX + dx
	}
	return
}
func getDots(count int) string {
	if count > 0 {
		return strings.Repeat(".", count)
	}
	return ""
}

func toInt(buf []byte) (n int) {
	for _, v := range buf {
		n = (n * 10) + int(v-'0')
	}
	return
}

func main() {
	//	f, _ := os.Open("test.txt")
	//	reader = bufio.NewReader(f)

	defer writer.Flush()

	//writeString("0123"[2+1 : 4])

	var t int
	scanf("%d\n", &t) // 1≤t≤400

	for t > 0 {
		var n int

		scanf("%d\n", &n) // 2≤n≤400

		x1, x2, y1, y2 := -1, -1, -1, -1
		for i := 0; i < n; i++ {
			line := readline()
			if x2 >= 0 {
				continue
			}

			firstStarPos := strings.Index(line, "*")
			if firstStarPos >= 0 {
				if x1 == -1 {
					x1 = i
					y1 = firstStarPos
					if firstStarPos+1 >= len(line) {
						continue
					}
					secondStarPos := strings.Index(line[firstStarPos+1:], "*")
					if secondStarPos >= 0 {
						x2 = i
						y2 = secondStarPos + firstStarPos + 1
					}
				} else {
					x2 = i
					y2 = firstStarPos
				}
			}
		}
		minX := min(x1, x2)
		minY := min(y1, y2)
		maxX := max(x1, x2)
		maxY := max(y1, y2)
		dx := maxX - minX
		dy := maxY - minY

		rx1, rx2 := search(minX, maxX, if0(dx, dy))
		ry1, ry2 := search(minY, maxY, if0(dy, dx))

		allDot := strings.Repeat(".", n) + "\n"

		for i := 0; i < n; i++ {
			if i == rx1 || i == rx2 {
				writeString(
					getDots(ry1) +
						"*" +
						getDots(ry2-ry1-1) +
						"*" +
						getDots(n-ry2-1) +
						"\n",
				)
			} else {
				writeString(allDot)
			}
		}
		t--
	}
}

package main

import (
	"fmt"
)

type Coord struct {
	i, j int
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x < y {
		return y
	}
	return x
}

func main() {
	var T int
	fmt.Scan(&T)
	for t := 0; t < T; t++ {
		var n int
		fmt.Scan(&n)
		var a, b Coord
		a.i = -1
		b.i = -1
		for i := 0; i < n; i++ {
			var line string
			fmt.Scanln(&line)
			for j, c := range(line) {
				if c == '*' {
					if a.i == -1 {
						a.i, a.j = i, j
					} else {
						b.i, b.j = i, j
					}
				}
			}
		}
		var c, d Coord
		if a.i != b.i && a.j != b.j {
			c.i, c.j = a.i, b.j
			d.i, d.j = b.i, a.j
		} else if a.i == b.i {
			if a.i > 0 {
				c.i, c.j = a.i - 1, a.j
				d.i, d.j = a.i - 1, b.j
			} else {
				c.i, c.j = a.i + 1, a.j
				d.i, d.j = a.i + 1, b.j
			}
		} else {
			if a.j > 0 {
				c.j, c.i = a.j - 1, a.i
				d.j, d.i = a.j - 1, b.i
			} else {
				c.j, c.i = a.j + 1, a.i
				d.j, d.i = a.j + 1, b.i
			}
		}

		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				isAsterix := false
				for _, cur := range([]Coord{a, b, c, d}) {
					isAsterix = isAsterix || (cur.i == i && cur.j == j)
				}
				if isAsterix {
					fmt.Print("*")
				} else {
					fmt.Print(".")
				}
			}
			fmt.Println()
		}
	}
}

package main

import (
	"fmt"
)

func solve() {
	var n int
	fmt.Scanf("%d\n", &n)

	x1, x2, y1, y2 := -1, -1, -1, -1

	var mat [][]byte
	var c byte
	for i := 0; i < n; i++ {
		var row []byte
		for j := 0; j < n; j++ {
			fmt.Scanf("%c", &c)
			row = append(row, c)
			if c == '*' {
				if x1 == -1 {
					x1, y1 = i, j
				} else {
					x2, y2 = i, j
				}
			}
		}
		fmt.Scanf("\n")
		mat = append(mat, row)
	}

	if x1 == x2 {
		if x1+1 < n {
			mat[x1+1][y1] = '*'
			mat[x2+1][y2] = '*'
		} else {
			mat[x1-1][y1] = '*'
			mat[x2-1][y2] = '*'
		}
	} else if y1 == y2 {
		if y1+1 < n {
			mat[x1][y1+1] = '*'
			mat[x2][y2+1] = '*'
		} else {
			mat[x1][y1-1] = '*'
			mat[x2][y2-1] = '*'
		}
	} else {
		mat[x1][y2] = '*'
		mat[x2][y1] = '*'
	}

	fmt.Println("output")
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			fmt.Printf("%c", mat[i][j])
		}
		fmt.Printf("\n")
	}
}

func main() {
	var t int
	fmt.Scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}

}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var T, N int
	var line string
	Fscan(in, &T)
	for t := 0; t < T; t++ {
		Fscan(in, &N)
		grid := make([][]int, N)
		type coord struct{ y, x int }
		corners := []coord{}
		for i := 0; i < N; i++ {
			grid[i] = make([]int, N)
			Fscan(in, &line)
			for j := 0; j < N; j++ {
				if line[j] == '.' {
					grid[i][j] = 0
				} else {
					grid[i][j] = 1
					corners = append(corners, coord{i, j})
				}
			}
		}
		y0, x0 := corners[0].y, corners[0].x
		y1, x1 := corners[1].y, corners[1].x

		if y0 == y1 {
			if y0 == 0 {
				grid[1][x0] = 1
				grid[1][x1] = 1
			} else if y0 == N-1 {
				grid[N-2][x0] = 1
				grid[N-2][x1] = 1
			}
		} else if x0 == x1 {
			if x0 == 0 {
				grid[y0][1] = 1
				grid[y1][1] = 1
			} else if x0 == N-1 {
				grid[y0][N-2] = 1
				grid[y1][N-2] = 1
			}
		} else {
			grid[y0][x1] = 1
			grid[y1][x0] = 1
		}
		for i := 0; i < N; i++ {
			for j := 0; j < N; j++ {
				if grid[i][j] == 0 {
					Fprint(out, ".")
				} else {
					Fprint(out, "*")
				}
			}
			Fprintln(out)
		}
	}
}

package main

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

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

	var t int

	fmt.Fscan(r, &t)

	for t1 := 0; t1 < t; t1++ {
		var n int

		fmt.Fscan(r, &n)

		rec := make([]string, n)

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

		a, b, c, d := solve(&rec)

		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				if (i == a && j == b) || (i == c && d == j) {
					fmt.Print("*")
				} else {
					fmt.Print(rec[i][j])
				}
			}
			fmt.Println()
		}
	}
}

func solve(rec *[]string) (int, int, int, int){

	n :=  len(*rec)
	var fRow, fCol int = -1, -1
	var sRow, sCol int = -1, -1

	for i := 0; i < len(*rec); i++ {
		for j := 0; j < len((*rec)[i]); j++ {
			if (*rec)[i][j] == '*' {
				if fRow == -1 {
					fRow = i
					fCol = j
				} else {
					sRow = i
					sCol = j
				}
			}
		}
	}

	if fRow == sRow && fRow < n - 1 {
		return fRow + 1, fCol, fRow + 1, sCol
	} else if fRow == sRow && fRow == n - 1 {
		return fRow - 1, fCol, fRow - 1, sCol
	} else if fCol == sCol && fCol < n - 1 {
		return fRow, fCol + 1, sRow, fCol + 1
	} else if fCol == sCol && fCol == n - 1 {
		return fRow, fCol - 1, sRow, fCol - 1

	} else {
		return fRow, sCol, sRow, fCol
	}
}