// Date: 2023-03-14 10:02:51
// Problem: C. Engineer Artem
// Contest: Codeforces - Codeforces Round 682 (Div. 2)
// URL: https://codeforces.com/problemset/problem/1438/C
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// --------By WIDA--------
#include <bits/stdc++.h>
using namespace std;
namespace WIDA {
using LL = long long;
using PII = pair<LL, LL>;
using TII = tuple<LL, LL, LL>;
#define FOR(i,a,b) for (int i = (int)(a); i <= (int)(b); i ++)
#define FOR2(i,a,b) for (int i = (int)(a); i <= (int)(b); i += 2)
#define FORD(i,b,a) for (int i = (int)(a); i >= (int)(b); i --)
#define ALL(a) a.begin(), a.end()
#define rALL(a) a.rbegin(), a.rend()
#define pb push_back
#define fi first
#define se second
#define sz size()
const LL INF = 0x3f3f3f3f3f3f3f3f;
template <class... Args> void _(Args... args) {
auto _ = [&](auto x) { cout << x << " "; };
cout << "--->"; int arr[] = {(_(args), 0)...};
cout << "\n";
}
template <class T> void _i(T args) {
cout << "{";
for (auto i : args) cout << i << ", "; cout << "}\n";
}
template <class T> void _ii(T args) {
cout << "{";
for (auto [i, j] : args) cout << i << " " << j << ", ";
cout << "}\n";
}
template <class... Args> void __(Args... args) {
auto _ = [&](auto x) { cout << x << " "; };
int arr[] = {(_(args), 0)...}; cout << "\n";
}
#define int long long // Zmod要关闭
#define endl "\n" // 交互题要关闭
const int MOD = 998244353; // 看清楚每道题的 MOD
const int N = 1e6 + 7; // 二维数组要修改 vector<vector<int> > a(n, vector<int> (m, 0));
}
using namespace WIDA;
bool Solve() {
int n, m; cin >> n >> m;
for (int i = 1; i <= n; ++ i) {
for (int j = 1; j <= m; ++ j) {
int x; cin >> x;
if ((i + j) % 2 != x % 2) cout << x + 1 << " ";
else cout << x << " ";
}
cout << endl;
}
return 0;
}
signed main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int Task = 1;
cin >> Task;
for (int i = 1; i <= Task; ++ i) {
Solve();
// cout << (Solve() ? "YES" : "NO") << endl;
}
return 0;
}
770A - New Password | 1646B - Quality vs Quantity |
80A - Panoramix's Prediction | 1354B - Ternary String |
122B - Lucky Substring | 266B - Queue at the School |
1490A - Dense Array | 1650B - DIV + MOD |
1549B - Gregor and the Pawn Game | 553A - Kyoya and Colored Balls |
1364A - XXXXX | 1499B - Binary Removals |
1569C - Jury Meeting | 108A - Palindromic Times |
46A - Ball Game | 114A - Cifera |
776A - A Serial Killer | 25B - Phone numbers |
1633C - Kill the Monster | 1611A - Make Even |
1030B - Vasya and Cornfield | 1631A - Min Max Swap |
1296B - Food Buying | 133A - HQ9+ |
1650D - Twist the Permutation | 1209A - Paint the Numbers |
1234A - Equalize Prices Again | 1613A - Long Comparison |
1624B - Make AP | 660B - Seating On Bus |