#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
int absv(int x) { return x < 0 ? -x : x; }
int n, x[2005], G[2005][2005];
char S[2005][2005];
bool dfs(int v, int c) {
  if (x[v] == !c)
    return false;
  else if (x[v] == c)
    return true;
  x[v] = c;
  for (int i = 0; i < (int)(n + 1); i++)
    if (G[v][i] != -1 && !dfs(i, c ^ G[v][i])) return false;
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); i++) scanf("%s", S[i]);
  if (n & 1) {
    printf("NONE\n");
    return 0;
  }
  for (int i = 0; i < (int)(n + 1); i++)
    for (int j = 0; j < (int)(n + 1); j++) G[i][j] = -1;
  for (int i = 0; i < n; i += 2) G[i][i + 2] = G[i + 2][i] = 1;
  for (int i = 0; i < (int)(n); i++)
    for (int j = 0; j < (int)(n); j++)
      if (S[i][j] != '.') {
        int val = (S[i][j] == 'S') ^ (i & 1) ^ (j & 1);
        int d0 = absv(i - j), d1 = absv(i + j - n + 1);
        if (G[d0][n - d1] == !val) {
          printf("NONE\n");
          return 0;
        }
        G[d0][n - d1] = G[n - d1][d0] = val;
      }
  for (int i = 0; i < (int)(n + 1); i++) x[i] = -1;
  int cnt = 0;
  for (int i = 0; i < (int)(n + 1); i++)
    if (x[i] == -1) {
      cnt++;
      if (!dfs(i, 0)) {
        printf("NONE\n");
        return 0;
      }
    }
  if (cnt >= 2)
    printf("MULTIPLE\n");
  else {
    for (int i = 0; i < (int)(n); i++)
      for (int j = 0; j < (int)(n); j++)
        S[i][j] =
            (i & 1) ^ (j & 1) ^ x[absv(i - j)] ^ x[n - absv(i + j - n + 1)]
                ? 'S'
                : 'G';
    printf("UNIQUE\n");
    for (int i = 0; i < (int)(n); i++) printf("%s\n", S[i]);
  }
  return 0;
}

### Prompt

Develop a solution in cpp to the problem described below:

Omkar is creating a mosaic using colored square tiles, which he places in an n × n grid. When the mosaic is complete, each cell in the grid will have either a glaucous or sinoper tile. However, currently he has only placed tiles in some cells. 

A completed mosaic will be a mastapeece if and only if each tile is adjacent to exactly 2 tiles of the same color (2 tiles are adjacent if they share a side.) Omkar wants to fill the rest of the tiles so that the mosaic becomes a mastapeece. Now he is wondering, is the way to do this unique, and if it is, what is it?

Input

The first line contains a single integer n (1 ≤ n ≤ 2000).

Then follow n lines with n characters in each line. The i-th character in the j-th line corresponds to the cell in row i and column j of the grid, and will be S if Omkar has placed a sinoper tile in this cell, G if Omkar has placed a glaucous tile, . if it's empty. 

Output

On the first line, print UNIQUE if there is a unique way to get a mastapeece, NONE if Omkar cannot create any, and MULTIPLE if there is more than one way to do so. All letters must be uppercase.

If you print UNIQUE, then print n additional lines with n characters in each line, such that the i-th character in the j^{th} line is S if the tile in row i and column j of the mastapeece is sinoper, and G if it is glaucous. 

Examples

Input


4
S...
..G.
....
...S


Output


MULTIPLE


Input


6
S.....
....G.
..S...
.....S
....G.
G.....


Output


NONE


Input


10
.S....S...
..........
...SSS....
..........
..........
...GS.....
....G...G.
..........
......G...
..........


Output


UNIQUE
SSSSSSSSSS
SGGGGGGGGS
SGSSSSSSGS
SGSGGGGSGS
SGSGSSGSGS
SGSGSSGSGS
SGSGGGGSGS
SGSSSSSSGS
SGGGGGGGGS
SSSSSSSSSS


Input


1
.


Output


NONE

Note

For the first test case, Omkar can make the mastapeeces

SSSS

SGGS

SGGS

SSSS

and 

SSGG

SSGG

GGSS

GGSS.

For the second test case, it can be proven that it is impossible for Omkar to add tiles to create a mastapeece.

For the third case, it can be proven that the given mastapeece is the only mastapeece Omkar can create by adding tiles.

For the fourth test case, it's clearly impossible for the only tile in any mosaic Omkar creates to be adjacent to two tiles of the same color, as it will be adjacent to 0 tiles total. 

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
int absv(int x) { return x < 0 ? -x : x; }
int n, x[2005], G[2005][2005];
char S[2005][2005];
bool dfs(int v, int c) {
  if (x[v] == !c)
    return false;
  else if (x[v] == c)
    return true;
  x[v] = c;
  for (int i = 0; i < (int)(n + 1); i++)
    if (G[v][i] != -1 && !dfs(i, c ^ G[v][i])) return false;
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); i++) scanf("%s", S[i]);
  if (n & 1) {
    printf("NONE\n");
    return 0;
  }
  for (int i = 0; i < (int)(n + 1); i++)
    for (int j = 0; j < (int)(n + 1); j++) G[i][j] = -1;
  for (int i = 0; i < n; i += 2) G[i][i + 2] = G[i + 2][i] = 1;
  for (int i = 0; i < (int)(n); i++)
    for (int j = 0; j < (int)(n); j++)
      if (S[i][j] != '.') {
        int val = (S[i][j] == 'S') ^ (i & 1) ^ (j & 1);
        int d0 = absv(i - j), d1 = absv(i + j - n + 1);
        if (G[d0][n - d1] == !val) {
          printf("NONE\n");
          return 0;
        }
        G[d0][n - d1] = G[n - d1][d0] = val;
      }
  for (int i = 0; i < (int)(n + 1); i++) x[i] = -1;
  int cnt = 0;
  for (int i = 0; i < (int)(n + 1); i++)
    if (x[i] == -1) {
      cnt++;
      if (!dfs(i, 0)) {
        printf("NONE\n");
        return 0;
      }
    }
  if (cnt >= 2)
    printf("MULTIPLE\n");
  else {
    for (int i = 0; i < (int)(n); i++)
      for (int j = 0; j < (int)(n); j++)
        S[i][j] =
            (i & 1) ^ (j & 1) ^ x[absv(i - j)] ^ x[n - absv(i + j - n + 1)]
                ? 'S'
                : 'G';
    printf("UNIQUE\n");
    for (int i = 0; i < (int)(n); i++) printf("%s\n", S[i]);
  }
  return 0;
}

```