Problem: You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it [here](http://tiny.cc/636xmz).

The picture showing the correct sudoku solution:

<image>

Blocks are bordered with bold black color.

Your task is to change at most 9 elements of this field (i.e. choose some 1 ≤ i, j ≤ 9 and change the number at the position (i, j) to any other number in range [1; 9]) to make it anti-sudoku. The anti-sudoku is the 9 × 9 field, in which:

  * Any number in this field is in range [1; 9]; 
  * each row contains at least two equal elements; 
  * each column contains at least two equal elements; 
  * each 3 × 3 block (you can read what is the block in the link above) contains at least two equal elements. 



It is guaranteed that the answer exists.

You have to answer t independent test cases.

Input

The first line of the input contains one integer t (1 ≤ t ≤ 10^4) — the number of test cases. Then t test cases follow.

Each test case consists of 9 lines, each line consists of 9 characters from 1 to 9 without any whitespaces — the correct solution of the sudoku puzzle.

Output

For each test case, print the answer — the initial field with at most 9 changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.

Example

Input


1
154873296
386592714
729641835
863725149
975314628
412968357
631457982
598236471
247189563


Output


154873396
336592714
729645835
863725145
979314628
412958357
631457992
998236471
247789563

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
const int LIM = 2e5 + 5;
using namespace std;
vector<bool> prime;
void SieveOfEratosthenes(long long n) {
  prime.assign(n + 1, 1);
  for (long long p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
}
bool isPrime(long long n) {
  if (n < 2) return false;
  for (long long i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
std::vector<long long> generatePrimeFactors(long long n) {
  std::vector<long long> prime;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      prime.push_back(i);
      while (n % i == 0) n = n / i;
    }
  }
  if (n != 1) prime.push_back(n);
  return prime;
}
map<long long, long long> generatePrimeFactorization(long long n) {
  map<long long, long long> cnt;
  for (long long i = 2; i * i <= n; i++) {
    while (n && n % i == 0) {
      n /= i;
      cnt[i]++;
    }
  }
  if (n != 1) cnt[n]++;
  return cnt;
}
std::vector<long long> generateFactors(long long n) {
  std::vector<long long> fact;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      fact.push_back(i);
      if (n / i != i) fact.push_back(n / i);
    }
  }
  if (n != 1) fact.push_back(n);
  sort(fact.begin(), fact.end());
  return fact;
}
long long extendedGCD(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1, d;
  d = extendedGCD(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
long long multiply(long long a, long long b, long long m);
long long singlemod(long long a, long long m);
long long modpow(long long x, long long n, long long m) {
  if (n == 0) return 1;
  long long res = 1;
  while (n) {
    if (n % 2) res = multiply(res, x, m);
    x = multiply(x, x, m);
    n = n >> 1;
  }
  return singlemod(res, m);
}
long long fastpow(long long x, long long n) {
  if (n == 0) return 1;
  long long res = 1;
  while (n) {
    if (n % 2) res = res * x;
    x = x * x;
    n = n >> 1;
  }
  return res;
}
long long modinverse(long long x, long long m) { return modpow(x, m - 2, m); }
long long add(long long a, long long b, long long m) {
  return (((a % m) + (b % m)) % m);
}
long long substract(long long a, long long b, long long m) {
  return (((a % m) - (b % m) + m) % m);
}
long long multiply(long long a, long long b, long long m) {
  return (((a % m) * (b % m)) % m);
}
long long divide(long long a, long long b, long long m) {
  long long temp = modinverse(b, m);
  return multiply(a, temp, m);
}
long long singlemod(long long a, long long m) { return (((a % m) + m) % m); }
long long eulerstotientfunction(long long n) {
  long long ans = n;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      while (n % i == 0) n = n / i;
      ans -= ans / i;
    }
  }
  if (n > 1) ans -= ans / n;
  return ans;
}
long long ncr(long long n, long long k, long long m) {
  if (k > n) return 0;
  if (m == 0) {
    long long res = 1;
    k = min(k, n - k);
    for (long long i = 1; i <= k; i++) {
      res *= (n - i + 1);
      res /= i;
    }
    return res;
  } else {
    long long res = 1;
    k = min(k, n - k);
    for (long long i = 1; i <= k; i++) {
      res = multiply(res, n - i + 1, m);
      res = divide(res, i, m);
    }
    return singlemod(res, m);
  }
}
template <class T>
void printVector(const std::vector<T> arr) {
  for (auto i : arr) cout << i << " ";
  cout << '\n';
}
template <class T>
void printArray(T arr[], long long n) {
  for (long long i = 0; i < n; i++) cout << arr[i] << " ";
  cout << '\n';
}
template <class T>
void printUGraph(vector<T> arr[], long long n) {
  for (long long i = 0; i < n; i++) {
    cout << i << " : ";
    for (auto j : arr[i]) cout << j << " ";
    cout << '\n';
  }
}
template <class T>
void printWGraph(vector<T> arr[], long long n) {
  for (long long i = 0; i < n; i++) {
    cout << i << " : ";
    for (auto j : arr[i]) cout << j.fi << "," << j.se << " ";
    cout << '\n';
  }
}
const int N = 1e5 + 5;
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int tc;
  cin >> tc;
  while (tc--) {
    for (int i = 0; i < int(9); i++) {
      string s;
      cin >> s;
      for (auto &c : s)
        if (c == '5') c = '7';
      cout << s << '\n';
    }
  }
  return 0;
}