voidwork(){ cin >> n >> m; for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) cin >> a[i][j]; for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) if (i + j & 1) a[i][j] += a[i][j] & 1; else a[i][j] += !(a[i][j] & 1); for (int i = 1; i <= n; ++i, puts("")) for (int j = 1; j <= m; ++j) cout << a[i][j] << " "; }
intmain(){ int T; cin >> T; while (T--) work(); return0; }