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++: #define _crt_secure_no_warnings

#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif


#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;

int main()
{
	int N;
	cin >> N;
	for (size_t i = 0; i < N; i++)
	{
		int data[9][9];
		bool ans[9][9] = {};
		for (size_t i = 0; i < 9; i++)
		{
			for (size_t j = 0; j < 9; j++)
			{
				cin >> data[i][j];
				data[i][j]--;
			}
		}
		for (size_t i = 0; i < 9; i++)
		{
			int a[9] = {}, b[9] = {};
			for (size_t j = 0; j < 9; j++)
			{
				a[data[i][j]]++;
				b[data[j][i]]++;
			}
			for (size_t j = 0; j < 9; j++)
			{
				if (a[j] != 1)
				{
					for (size_t k = 0; k < 9; k++)
					{
						if (data[i][k] == j)
						{
							ans[i][k] = 1;
						}
					}
				}
				if (b[j] != 1)
				{
					for (size_t k = 0; k < 9; k++)
					{
						if (data[k][i] == j)
						{
							ans[k][i] = 1;
						}
					}
				}
			}
		}
		for (size_t i = 0; i < 3; i++)
		{
			for (size_t j = 0; j < 3; j++)
			{
				int c[9] = {};
				for (size_t k = 0; k < 3; k++)
				{
					for (size_t l = 0; l < 3; l++)
					{
						c[data[i * 3 + k][j * 3 + l]]++;
					}
				}
				for (size_t k = 0; k < 9; k++)
				{
					if (c[k] != 1)
					{
						for (size_t l = 0; l < 3; l++)
						{
							for (size_t m = 0; m < 3; m++)
							{
								if (data[i * 3 + l][j * 3 + m] == k)
								{
									ans[i * 3 + l][j * 3 + m] = 1;
								}
							}
						}
					}
				}
			}
		}
		for (size_t i = 0; i < 9; i++)
		{
			for (size_t j = 0; j < 9; j++)
			{
				cout << (ans[i][j] ? "*" : " ") << data[i][j] + 1;
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstring>

using namespace std;

int main(void) {
	int num;
	int map[9][9], check[10];
	bool mapb[9][9];
	int i, j, k;

	cin >> num;

	for(i = 0; i < num; i++) {
		for(j = 0; j < 9; j++) {
			for(k = 0; k < 9; k++) {
				cin >> map[j][k];
				mapb[j][k] = false;
			}
		}

		for(j = 0; j < 9; j++) {
			memset(check, 0, sizeof(check));
			for(k = 0; k < 9; k++) {
				check[map[j][k]]++;
			}
			for(k = 0; k < 9; k++) {
				if(check[map[j][k]] >= 2) { mapb[j][k] = true; }
			}
		}

		for(j = 0; j < 9; j++) {
			memset(check, 0, sizeof(check));
			for(k = 0; k < 9; k++) {
				check[map[k][j]]++;
			}
			for(k = 0; k < 9; k++) {
				if(check[map[k][j]] >= 2) { mapb[k][j] = true; }
			}
		}

		for(j = 0; j < 9; j++) {
			memset(check, 0, sizeof(check));
			for(k = 0; k < 9; k++) {
				check[map[k/3+(j/3)*3][k%3+(j%3)*3]]++;
			}
			for(k = 0; k < 9; k++) {
				if(check[map[k/3+(j/3)*3][k%3]] >= 2) { mapb[k/3+(j/3)*3][k%3] = true; }
			}
		}

		for(j = 0; j < 9; j++) {
			for(k = 0; k < 9; k++) {
				cout << (mapb[j][k]?"*":" ") << map[j][k];
			}
			cout << endl;
		}

		if(i+1 < num) { cout << endl; }
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>

using namespace std;

int main(void)
{
	int n, table[9][9];
	bool ok[9][9];
	cin >> n;
	for (int cnt = 0; cnt < n; cnt++){
		for (int i = 0; i < 9; i++){
			for (int j = 0; j < 9; j++){
				cin >> table[i][j];
				ok[i][j] = true;
			}
		}
		
		cout << "input ok" << endl;
		// れつ
		for (int i = 0; i < 9; i++){
			bool done[10] = {false};
			for (int j = 0; j < 9; j++){
				if (done[table[i][j]]){
					ok[i][j] = false;
					for (int k = 0; k < j; k++){
						if (table[i][j] == table[i][k]){
							ok[i][k] = false;
						}
					}
				}
				done[table[i][j]] = true;
			}
		}
		
		// ぎょう
		for (int i = 0; i < 9; i++){
			bool done[10] = {false};
			for (int j = 0; j < 9; j++){
				if (done[table[j][i]]){
					ok[j][i] = false;
					for (int k = 0; k < j; k++){
						if (table[j][i] == table[k][i]){
							ok[k][i] = false;
						}
					}
				}
				done[table[j][i]] = true;
			}
		}
		
		for (int y = 0; y < 9; y += 3){
			for (int x = 0; x < 9; x += 3){
				bool done[10] = {false};
				for (int i = 0; i < 3; i++){
					for (int j = 0; j < 3; j++){
						int ny = y + i, nx = x + j;
						// printf("%d ", table[ny][nx]);
						if (done[table[ny][nx]]){
							ok[ny][nx] = false;
							for (int k = 0; k < 3; k++){
								for (int l = 0; l < 3; l++){
									if (table[ny][nx] == table[y + k][x + l]){
										ok[y + k][x + l] = false;
									}
								}
							}
						}
						done[table[ny][nx]] = true;
					}
					// cout << endl;
				}
				// cout << endl;
			}
		}
		
		for (int i = 0; i < 9; i++){
			for (int j = 0; j < 9; j++){
				printf("%c%d", ok[i][j] ? ' ' : '*', table[i][j]);
			}
			cout << endl;
		}
		
		if (cnt + 1 < n) cout << endl;
	}
	
	return 0;
}