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 {
		n--
		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()
		}
	}
}

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

C++: #include<iostream>
#include<string>
using namespace std;
int main()
{
  int n;

  cin >> n;

  int pazzle[n][9][9];
  
  int point[n][9][9];
  
  //point={0}
  for(int i = 0;i < n;++i){
    for(int j = 0;j < 9;++j){
      for(int k = 0;k < 9;++k){
	point[i][j][k] = 0;
      }
    }
  }
			     
  
  //scan
  for(int i = 0;i < n;++i){
    for(int j = 0;j < 9;j++){
      for(int k = 0;k < 9;k++){
	cin >> pazzle[i][j][k];
      }
    }
  }

  //syori
  for(int i = 0;i < n;i++){
    for(int j = 0;j < 9;j++){
      for(int k = 0;k < 9;k++){
	for(int l = 0;l < 9;l++){
	  //tate
	  if(pazzle[i][j][k] == pazzle[i][j][l] && k != l){
	    point[i][j][k] = 1;
	    point[i][j][l] = 1;
	  }
	  //yoko
	  if(pazzle[i][l][j] == pazzle[i][k][j] && k != l){
	    point[i][l][j] = 1;
	    point[i][k][j] = 1;
	  }
	}
      }
      //masu
      switch(j){
	
      case 0:{
	for(int a = 0;a < 3;a++){
	  for(int b = 0;b < 3;b++){
	    for(int c = 0;c < 3;c++){
	      for(int d = 0;d < 3;d++){
		if(pazzle[i][a][b] == pazzle[i][c][d] && (a != c && b != d) ){
		  point[i][a][b] = 1;
		  point[i][c][d] = 1;
		  break;
		}
	      }
	    }
	  }
	}
      }

      case 1:{
	for(int a = 0;a < 3;a++){
	  for(int b = 3;b < 6;b++){
	    for(int c = 0;c < 3;c++){
	      for(int d = 3;d < 6;d++){
		if(pazzle[i][a][b] == pazzle[i][c][d] && (a != c && b != d) ){
		  point[i][a][b] = 1;
		  point[i][c][d] = 1;
		  break;
		}
	      }
	    }
	  }
	}
      }

      case 2:{
	for(int a = 0;a < 3;a++){
	  for(int b = 6;b < 9;b++){
	    for(int c = 0;c < 3;c++){
	      for(int d = 6;d < 9;d++){
		if(pazzle[i][a][b] == pazzle[i][c][d] && (a != c && b != d) ){
		  point[i][a][b] = 1;
		  point[i][c][d] = 1;
		  break;
		}
	      }
	    }
	  }
	}
      }

      case 3:{
	for(int a = 3;a < 6;a++){
	  for(int b = 0;b < 3;b++){
	    for(int c = 3;c < 6;c++){
	      for(int d = 0;d < 3;d++){
		if(pazzle[i][a][b] == pazzle[i][c][d] && (a != c && b != d) ){
		  point[i][a][b] = 1;
		  point[i][c][d] = 1;
		  break;
		}
	      }
	    }
	  }
	}
      }

      case 4:{
	for(int a = 3;a < 6;a++){
	  for(int b = 3;b < 6;b++){
	    for(int c = 3;c < 6;c++){
	      for(int d = 3;d < 6;d++){
		if(pazzle[i][a][b] == pazzle[i][c][d] && (a != c && b != d) ){
		  point[i][a][b] = 1;
		  point[i][c][d] = 1;
		  break;
		}
	      }
	    }
	  }
	}
      }

      case 5:{
	for(int a = 3;a < 6;a++){
	  for(int b = 6;b < 9;b++){
	    for(int c = 3;c < 6;c++){
	      for(int d = 6;d < 9;d++){
		if(pazzle[i][a][b] == pazzle[i][c][d] && (a != c && b != d)){
		  point[i][a][b] = 1;
		  point[i][c][d] = 1;
		  break;
		}
	      }
	    }
	  }
	}
      }

      case 6:{
	for(int a = 6;a < 9;a++){
	  for(int b = 0;b < 3;b++){
	    for(int c = 6;c < 9;c++){
	      for(int d = 0;d < 3;d++){
		if(pazzle[i][a][b] == pazzle[i][c][d] && (a != c && b != d) ){
		  point[i][a][b] = 1;
		  point[i][c][d] = 1;
		  break;
		}
	      }
	    }
	  }
	}
      }

      case 7:{
	for(int a = 6;a < 9;a++){
	  for(int b = 3;b < 6;b++){
	    for(int c = 6;c < 9;c++){
	      for(int d = 3;d < 6;d++){
		if(pazzle[i][a][b] == pazzle[i][c][d] && (a != c && b != d) ){
		  point[i][a][b] = 1;
		  point[i][c][d] = 1;
		  break;
		}
	      }
	    }
	  }
	}
      }

      case 8:{
	for(int a = 6;a < 9;a++){
	  for(int b = 6;b < 9;b++){
	    for(int c = 6;c < 9;c++){
	      for(int d = 6;d < 9;d++){
		if(pazzle[i][a][b] == pazzle[i][c][d] && (a != c && b != d) ){
		  point[i][a][b] = 1;
		  point[i][c][d] = 1;
		  break;
		}
	      }
	    }
	  }
	}
      }
      }
    }
  }      

  //print
  for(int i = 0;i < n;i++){
    for(int j = 0;j < 9;j++){
      for(int k = 0;k < 9;k++){
	if(!point[i][j][k]){
	  cout << " " << pazzle[i][j][k];
	}
	else{
	  cout << "*" << pazzle[i][j][k];
	}
      }
      cout << endl;
    }
    if(i < n-1)cout << endl;
  }
}

C++: #include <iostream>
#include <stdio.h>
#include <utility>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
typedef pair<int,int> p;
int cen[]={1,4,7};
int main()
{
    int n;
	cin>>n;
	while(n--){
		int a[9][9];
		bool cor[9][9];
		
		for(int i=0;i<9;i++)
			for(int j=0;j<9;j++){
				cin>>a[i][j];
				cor[i][j]=true;
			}
		for(int i=0;i<9;i++){
			int check[9]={};
			for(int j=0;j<9;j++)check[a[i][j]-1]++;
			for(int j=0;j<9;j++)if(check[a[i][j]-1]!=1)cor[i][j]=false;
		}
		for(int i=0;i<9;i++){
			int check[9]={};
			for(int j=0;j<9;j++)check[a[j][i]-1]++;
			for(int j=0;j<9;j++)if(check[a[j][i]-1]!=1)cor[j][i]=false;
		}
		for(int i=0;i<3;i++)
			for(int j=0;j<3;j++){
				int check[9]={};
				for(int kx=-1;kx<=1;kx++)
					for(int ky=-1;ky<=1;ky++){
						int nx=cen[i]+kx,ny=cen[j]+ky;
						check[a[nx][ny]-1]++;
					}
				for(int kx=-1;kx<=1;kx++)
					for(int ky=-1;ky<=1;ky++){
						int nx=cen[i]+kx,ny=cen[j]+ky;
						if(check[a[nx][ny]-1]!=1)cor[nx][ny]=false;
					}
			}
		for(int i=0;i<9;i++){
			for(int j=0;j<9;j++){
				printf(cor[i][j]?" %d":"*%d",a[i][j]);
			}
			cout<<endl;
		}
		if(n!=0)cout<<endl;
	}
    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";
	}
	int s[9][9]={};
	cout<<"\n";
	}
	return 0;
}