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
}

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int n;
int f[9][9];
int ans[9][9];
int check(int x,int y)
{
	for(int i=0;i<9;i++)
	{
		if(i==y)continue;
		if(f[x][i]==f[x][y])return 1;
	}
	for(int i=0;i<9;i++)
	{
		if(i==x)continue;
		if(f[i][y]==f[x][y])return 1;
	}
	int nx=x,ny=y;
	while(nx%3!=0)nx--;
	while(ny%3!=0)ny--;
	for(int i=nx;i<nx+3;i++)
	{
		for(int j=ny;j<ny+3;j++)
		{
			if(i==x&&j==y)continue;
			if(f[i][j]==f[x][y])return 1;
		}
	}
	return 0;
}
int main()
{
	cin >> n;
	for(int s=0;s<n;s++)
	{
		memset(ans,0,sizeof(ans));
		for(int i=0;i<9;i++)
		{
			for(int j=0;j<9;j++)
			{
				cin >> f[i][j];
			}
		}
		for(int i=0;i<9;i++)
		{
			for(int j=0;j<9;j++)
			{
				ans[i][j]=check(i,j);
			}
		}
		for(int i=0;i<9;i++)
		{
			for(int j=0;j<9;j++)
			{
				if(ans[i][j])printf("*%d",f[i][j]);
				else printf(" %d",f[i][j]);
			}
			puts("");
		}
		if(s!=n-1)puts("");
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int p[9][9]={},s[9][9]={},a;
	cin>>a;
	for(int v=0;v<a;v++){
	for(int i=0;i<9;i++){
		for(int j=0;j<9;j++){
			cin>>p[i][j];
		}
	}
	for(int i=0;i<9;i++){
		for(int j=0;j<9;j++){
			for(int k=0;k<9;k++){
				if(p[i][j]==p[i][k]&&j!=k){
					s[i][j]=1;
				}
		}
		}
	}
	for(int i=0;i<9;i++){
		for(int j=0;j<9;j++){
			for(int k=0;k<9;k++){
				if(p[j][i]==p[k][i]&&j!=k){
					s[j][i]=1;
				}
			}
		}
	}
	int x=0,y=0;
	for(;;){
		for(int i=y;i<y+3;i++){
			for(int j=x;j<x+3;j++){
				for(int k=y;k<y+3;k++){
					for(int l=x;l<x+3;l++){
						if(p[i][j]==p[k][l]&&i!=k&&j!=l){
							s[j][i]=1;
						}
					}
				}
			}
		}
		if(x==6&&y==6)
			break;
		if(x==6){
			x=0;
			y+=3;
		}
		else
			x+=3;
	}
	for(int i=0;i<9;i++){
		for(int j=0;j<9;j++){
			if(s[i][j]==1)
				cout<<"*";
			else
				cout<<" ";
			cout<<p[i][j];
		}
		cout<<"\n\n";
	}
	int s[9][9]={};
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;cin>>n;
  int suudoku[n][9][9];
  int Map[n][9][9];
  for(int k=0;k<n;k++)
    for(int i=0;i<9;i++)
      for(int j=0;j<9;j++)
	Map[k][i][j]=0;
  for(int aa=0;aa<n;aa++){
    for(int i=0;i<9;i++)
      for(int j=0;j<9;j++)
	cin>>suudoku[aa][i][j];
    for(int i=0;i<9;i++){
      int suuretu[10]={};
      for(int j=0;j<10;j++)
	suuretu[j]=-1;
      for(int j=0;j<9;j++){
	if(suuretu[suudoku[aa][j][i]]!=-1){
	  Map[aa][j][i]=1;
	  Map[aa][suuretu[suudoku[aa][j][i]]][i]=1;
	}else{
	  suuretu[suudoku[aa][j][i]]=j;
	}
      }
    }
    for(int i=0;i<9;i++){
      int suuretu[10]={};
      for(int j=0;j<10;j++)
	suuretu[j]=-1;
      for(int j=0;j<9;j++){
	if(suuretu[suudoku[aa][i][j]]!=-1){
	  Map[aa][i][j]=1;
	  Map[aa][suuretu[suudoku[aa][i][j]]][j]=1;
	}else{
	  suuretu[suudoku[aa][i][j]]=i;
	}
      }
    }
    for(int i=0;i<9;i+=3){
      int suuretu[10]={};
      for(int j=0;j<10;j++)
	suuretu[j]=-1;
      for(int j=i;j<i+3;j++){
	if(suuretu[suudoku[aa][i][j]]!=-1){
	  Map[aa][i][j]=1;
	  Map[aa][suuretu[suudoku[aa][i][j]]][j]=1;
	}else{
	  suuretu[suudoku[aa][i][j]]=j;
	}
      }
    }
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<9;j++){
      for(int k=0;k<9;k++){
	if(Map[i][j][k]==1){
	  cout<<"*";
	}else{
	  cout<<" ";
	}
	cout<<suudoku[i][j][k];
      }
      if(i!=n-1||j!=8)
      cout<<endl;
    }
    if(i!=n-1)
      cout<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string.h>
using namespace std;

int n;
int a[9][9];
bool b[9][9], c[9];

int main()
{
	cin >> n;

	for (int i = 0; i < n; i++) {
		memset(b, 0, sizeof(b));

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

		for (int j = 0; j < 9; j++) {
			memset(c, 0, sizeof(c));
			for (int k = 0; k < 9; k++) {
				if (c[a[j][k] - 1]) {
					b[j][k] = 1;
					int u = k - 1;
					while (u > 0 && a[j][u] != a[j][k])
						u--;
					b[j][u] = 1;
				}
				else
					c[a[j][k] - 1] = 1;
			}
		}

		for (int k = 0; k < 9; k++) {
			memset(c, 0, sizeof(c));
			for (int j = 0; j < 9; j++) {
				if (c[a[j][k] - 1]) {
					b[j][k] = 1;
					int u = j - 1;
					while (u > 0 && a[u][k] != a[j][k])
						u--;
					b[u][k] = 1;
				}
				else
					c[a[j][k] - 1] = 1;
			}
		}

		for (int s = 0; s < 9; s++) {
			memset(c, 0, sizeof(c));
			for (int t = 0; t < 9; t++) {
				int j = t / 3 + (s / 3) * 3, k = t % 3 + (s % 3) * 3;

				if (c[a[j][k] - 1]) {
					b[j][k] = 1;
					int u = t - 1, v = u / 3 + (s / 3) * 3, w = u % 3 + (s % 3) * 3;
					while (u > 0 && a[v][w] != a[j][k]) {
						u--;
						v = u / 3 + (s / 3) * 3;
						w = u % 3 + (s % 3) * 3;
					}
					b[v][w] = 1;
				}
				else
					c[a[j][k] - 1] = 1;
			}
		}

		for (int j = 0; j < 9; j++) {
			for (int k = 0; k < 9; k++) {
				if (b[j][k])
					cout << "*";
				else
					cout << " ";

				cout << a[j][k];
			}
			cout << endl;
		}

		if (i != n - 1)
			cout << endl;
	}

	return 0;
}