Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	table := [9][9]int{}
	check := [9][9]bool{}
	n, _ := strconv.Atoi(scanner.Text())
	for n > 0 {
		for i := 0; i < 9; i++ {
			for j := 0; j < 9; j++ {
				table[i][j] = nextInt()
			}
		}
		for i := 0; i < 9; i++ {
			for j := 0; j < 9; j++ {
				ok := true
				for k := 0; k < 9; k++ {
					if table[i][j] == table[i][k] && j != k {
						ok = false
					}
				}
				for k := 0; k < 9; k++ {
					if table[i][j] == table[k][j] && i != k {
						ok = false
					}
				}
				seci := i / 3
				secj := j / 3
				for k := 0; k < 3; k++ {
					for l := 0; l > 3; l++ {
						if table[seci*3+k][secj*3+l] == table[i][j] && seci*3+k != i && secj*3+l != j {
							ok = false
						}
					}
				}
				if !ok {
					check[i][j] = true
				}
			}
		}
		for i := 0; i < 9; i++ {
			for j := 0; j < 9; j++ {
				if check[i][j] {
					fmt.Print("*")
				} else {
					fmt.Print(" ")
				}
				fmt.Print(table[i][j])
			}
			fmt.Println()
		}
		if n != 0 {
			fmt.Println()
		}
		n--
	}
}

func nextInt() int {
	scanner.Scan()
	i, e := strconv.Atoi(scanner.Text())
	if e != nil {
		panic(e)
	}
	return i
}

Python: import math

def isPutNum(board, x, y, n):
    for i in range(9):
        if board[x][i] == n:
            return False
    for i in range(9):
        if board[i][y] == n:
            return False
    xx = math.floor(x / 3)
    yy = math.floor(y / 3)
    for i in range(3):
        for j in range(3):
            if board[xx*3 + i][yy*3 + j] == n:
                return False
    return True

N = int(input())
table = [[0 for i in range(9)] for j in range(9)]
for l in range(N):
    if l > 0:
        print("")

    for i in range(9):
        table[i] = [int(j) for j in input().split()]

    for i in range(9):
        for j in range(9):
            tmp = table[i][j]
            table[i][j] = 0
            if isPutNum(table, i, j, tmp):
                print(" ", end="")
            else:
                print("*", end="")
            table[i][j] = tmp
            print(table[i][j], end="")
        print("")

Python: def trans(mp):
  ret = [[None] * 9 for _ in range(9)]
  for x in range(9):
    for y in range(9):
      ret[x][y] = mp[y][x]

  return ret

def fix(mp):
  fix_lst = []
  mp2 = trans(mp)
  for i in range(9):
    for j in range(9):
      if mp[i].count(mp[i][j]) > 1:
        fix_lst.append((i, j))
      if mp2[i].count(mp2[i][j]) > 1:
        fix_lst.append((j, i))

  for ulx in (0, 3, 6):
    for uly in (0, 3, 6):
      tmp = []
      for dx in (0, 1, 2):
        for dy in (0, 1, 2):
          tmp.append(mp[ulx + dx][uly + dy])

      for dx in (0, 1, 2):
        for dy in (0, 1, 2):
          if tmp.count(mp[ulx + dx][uly + dy]) > 1:
            fix_lst.append((ulx + dx, uly + dy))
  
  fix_lst = list(set(fix_lst))
  for x, y in fix_lst:
    mp[x][y] = "*"  + mp[x][y]

  return mp

def _rj(c):
  return c.rjust(2)

def print_mp(mp):
  for line in mp:
    print("".join(map(_rj, line)))

n = int(input())
for i in range(n):
  if i != 0:
    print()
  mp = [input().split() for _ in range(9)]
  mp = fix(mp)
  print_mp(mp)

Python: n=int(input())
for i in range(n):
    board=[]
    check=[[0 for a in range(9)] for b in range(9)]
    for j in range(9):
        board.append(list(map(int,input().split())))
    board_r = [list(x) for x in zip(*board)]
    for j in range(9):
        for k in range(9):
            if board[j].count(board[j][k])>1:check[j][k]=1
    for j in range(9):
        for k in range(9):
            if board_r[j].count(board_r[j][k])>1:check[k][j]=1
    for j in range(3):
        for k in range(3):
            ch_list=[]
            for l in range(9):
                ch_list.append(board[j*3+l%3][k*3+l//3])
            for l in range(9):
                if ch_list.count(ch_list[l])>1:check[j*3+l%3][k*3+l//3]=1
    for j in range(9):
        for k in range(9):    
            if check[j][k]==1:print("*",end="")
            else:print(" ",end="")
            print(board[j][k],end="")
        print()
    if i<n-1:print()

C++: #include <iostream>

using namespace std;

 int main(void) {


	 int n;
	 int stage[9][9];
	 int cnt[3][9][10];

	 cin >> n;

	 for (int i = 0; i < n; i++){

		 for (int j = 0; j < 9; j++){
			 for (int k = 0; k < 9; k++){
				 cin >> stage[j][k];
			 }
		 }

		 for (int j = 0; j < 3; j++){
			 for (int k = 0; k < 9; k++){
				 for (int l = 0; l < 10; l++){
					 cnt[j][k][l] = 0;
				 }
			 }
		 }

		 for (int j = 0; j < 9; j++){
			 for (int k = 0; k < 9; k++){
				 cnt[0][j][stage[j][k]]++;
				 cnt[1][j][stage[k][j]]++;
				 cnt[2][j][stage[k / 3 + (j / 3) * 3][k % 3 + (j % 3) * 3]]++;
			 }
		 }

		 for (int j = 0; j < 9; j++){
			 for (int k = 0; k < 9; k++){
				 if (cnt[0][j][stage[j][k]] <= 1 && cnt[1][k][stage[j][k]] <= 1 && cnt[2][j][stage[k / 3 + (j / 3) * 3][k % 3 + (j % 3) * 3]] <= 1) cout << " " << stage[j][k];
				 else cout << "*" << stage[j][k];
			 }
			 cout << endl;
		 }

	 }

	 return 0;
	
}

C++: #include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll n;
  cin >> n;
  rep(z, n) {
    if(z) cout << endl;
    ll ch[9][9];
    bool result[9][9];
    rep(i, 9) rep(j, 9) {
      cin >> ch[i][j];
      result[i][j] = false;
    }
    rep(i, 9) rep(j, 9) {
      ll a, b;
      a = ((i + 3) % 3);
      b = ((j + 3) % 3);
      rep(k, j) if(ch[i][j] == ch[i][k]) result[i][j] = result[i][k] = true;
      FOR(k, j + 1, 9) if(ch[i][j] == ch[i][k]) result[i][j] = result[i][k] = true;
      rep(k, i) if(ch[i][j] == ch[k][j]) result[i][j] = result[k][j] = true;
      FOR(k, i + 1, 9) if(ch[i][j] == ch[k][j]) result[i][j] = result[k][j] = true;
      for(int k = (i - a); k < (i - a + 3); k++) {
        for(int l = (j - b); l < (j - b + 3); l++) {
          if(i == k && j == l) continue;
          if(ch[i][j] == ch[k][l]) result[i][j] = result[k][l] = true;
        }
      }
    }
    rep(i, 9) {
      rep(j, 9) {
      if(result[i][j]) cout << '*';
      else cout << ' ';
      cout << ch[i][j];
      }
      cout << endl;
    }
  }
	return 0;
}

C++: #include <cstdio>
using namespace std;

int main(){
    int N;
    for(scanf("%d", &N); N--;){
        char pz[9][12] = {};
        char res[9][12] = {};
        for(int i = 0; i < 9; i++){
            for(int j = 0; j < 9; j++){
                scanf(" %c", &pz[i][j]);
            }
        }
        for(int i = 0; i < 9; i++){
            for(int j = 0; j < 9; j++){
                bool flg = true;
                for(int k = 0; k < 9; k++){
                    if(i == k) continue;
                    if(pz[i][j] == pz[k][j]) flg = 0;
                }
                for(int k = 0; k < 9; k++){
                    if(j == k) continue;
                    if(pz[i][j] == pz[i][k]) flg = 0;
                }
                int r = i/3*3, c = j/3*3;
                for(int k = 0; k < 3; k++){
                    for(int l = 0; l < 3; l++){
                        if(r + k == i && c + l == j) continue;
                        if(pz[i][j] == pz[r+k][c+l]) flg = 0;
                    }
                }
                if(flg){
                    res[i][j] = ' ';
                }else{
                    res[i][j] = '*';
                }
            }
        }
        for(int i = 0; i < 9; i++){
            for(int j = 0; j < 9; j++){
                printf("%c", res[i][j]);
                printf("%c", pz[i][j]);
            }
            puts("");
        }
        if(N>=1) puts("");
    }
    return 0;
}