Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Split(bufio.ScanWords)
	for 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 <algorithm>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <queue>
#include <vector>
#include <sstream>
#include <functional>
using namespace std;
char table[6][5]={
{'a','b','c','d','e'},
{'f','g','h','i','j'},
{'k','l','m','n','o'},
{'p','q','r','s','t'},
{'u','v','w','x','y'},
{'z','.','?','!',' '},
};
int main()
{
	string s;
    while(cin>>s){
		if(!(s.length()%2))for(int i=0;i<(int)s.length();i+=2){
			if(1<=s[i]-'0'&&s[i]-'0'<=6&&1<=s[i+1]-'0'&&s[i+1]-'0'<=5)cout<<table[s[i]-'0'-1][s[i+1]-'0'-1];
			else {cout<<"NA";break;}
		}else{
			cout<<"NA";
		}
		cout<<endl;
	}
    return 0;
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<cstdio>
#include<cmath>
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
	int n;
	cin>>n;
	bool h=false;
	rep(w,n){
	if(h)cout<<endl;
		int in[9][9]={0};
		rep(j,9)rep(k,9)cin>>in[j][k];
		int out[9][9]={0};
		rep(i,9){
			rep(j,9){
				int co=0;
				rep(k,9)if(in[i][k]==j+1)co++;
				if(co>1)rep(k,9)if(in[i][k]==j+1)out[i][k]=1;
			}
		}
		rep(i,9){
			rep(j,9){
				int co=0;
				rep(k,9)if(in[k][i]==j+1)co++;
				if(co>1)rep(k,9)if(in[k][i]==j+1)out[k][i]=1;
			}
		}
		rep(i,3)rep(j,3){
			map<int,int>m;
			rep(a,3)rep(b,3)m[in[3*i+a][3*j+b]]++;
			rep(k,9)if(m[k+1]>=2)rep(a,3)rep(b,3)if(in[3*i+a][3*j+b]==k+1)out[3*i+a][3*j+b]=1;
		}
		rep(i,9){
			rep(j,9)
				if(out[i][j]==0)cout<<" "<<in[i][j];
				else cout<<"*"<<in[i][j];
			cout<<endl;
		}
		h=true;
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
    int n;
    cin >> n;
    rep(q, n){
        vii v; vbb b;
        rep(i, 9){
            vi r; vb l;
            rep(j, 9){
                int m; cin >> m; r.pb(m); l.pb(true);
            }
            v.pb(r); b.pb(l);
        }
        rep(i, 9){
            pair<bool, pair<int, int> > p[11];
            rep(j, 11) p[i].first = false;
            rep(j, 9){
                if(!p[v[i][j]].first){p[v[i][j]].first = true; p[v[i][j]].second = mp(i, j);}
                else {b[i][j] = false; pii x = p[v[i][j]].second; b[x.first][x.second] = false;}
            }
        }
        rep(i, 9){
            pair<bool, pair<int, int> > p[11];
            rep(j, 11) p[j].first = false;
            rep(j, 9){
                if(!p[v[j][i]].first){p[v[j][i]].first = true; p[v[j][i]].second = mp(j, i);}
                else {b[j][i] = false; pii x = p[v[j][i]].second; b[x.first][x.second] = false;}
            }
        }
        rep(i, 3)rep(j, 3){
            pair<bool, pair<int, int> > p[11];
            rep(l, 11) p[l].first = false;
            rep(k, 3)rep(l, 3){
                if(!p[v[i*3+k][j*3+l]].first){p[v[i*3+k][j*3+l]].first = true; p[v[i*3+k][j*3+l]].second = mp(i*3+k, j*3+l);}
                else {b[i*3+k][j*3+l] = false; pii x = p[v[i*3+k][j*3+l]].second; b[x.first][x.second] = false;  }
            }
        }

        rep(i, 9){
            rep(j, 9){
                cout << (b[i][j]?" ":"*") << v[i][j];
            }
            cout << endl;
        }
        cout << endl;
    }
}

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

void checkA( char a[9][18] )
{
    int b[10];
    
    for( int i = 0; i < 9; i++ )
    {
        for( int j = 0; j < 10; j++ )
            b[j] = 0;
        for( int j = 1; j < 18;  j += 2 )
            b[a[i][j]-'0']++;
        for( int j = 1; j < 18;  j += 2 )
            if( b[a[i][j]-'0'] >= 2 )
                a[i][j-1] = '*';
    }
}

void checkB( char a[9][18] )
{
    int b[10];
    
    for( int i = 1; i < 18; i += 2 )
    {
        for( int j = 0; j < 10; j++ )
            b[j] = 0;
        for( int j = 0; j < 9; j++ )
            b[a[j][i]-'0']++;
        for( int j = 0; j < 9; j++ )
            if( b[a[j][i]-'0'] >= 2 )
                a[j][i-1] = '*';
    }
}

void checkC2( char a[9][18], int x, int y, int w, int z )
{
    int b[10];

    for( int j = 0; j < 10; j++ )
        b[j] = 0;

    for( int i = x; i <= w; i++ )
        for( int j = y; j <= z; j += 2 )
            b[a[i][j]-'0']++;

    for( int i = x; i <= w; i++ )
        for( int j = y; j <= z; j += 2 )
            if( b[a[i][j]-'0'] >= 2 )
                a[i][j-1] = '*';
}

void checkC1( char a[9][18] )
{
    checkC2( a, 0, 1, 2, 5 );
    checkC2( a, 0, 7, 2, 11 );
    checkC2( a, 0, 13, 2, 17 );
    checkC2( a, 3, 1, 5, 5 );
    checkC2( a, 3, 7, 5, 11 );
    checkC2( a, 3, 13, 5, 17);
    checkC2( a, 6, 1, 8, 5 );
    checkC2( a, 6, 7, 8, 11 );
    checkC2( a, 6, 13, 8, 17 );
}

int main()
{
    int n;

    cin >> n;

    for( int i = 0; i < n; i++ )
    {
        if( i != 0 )
            cout << endl;

        char a[9][18];
        for( int j = 0; j < 9; j++ )
        {
            for( int k = 0; k < 18; k++ )
            {
                if( k % 2 == 0 )
                    a[j][k] = ' ';
                else
                    cin >> a[j][k];
            }
        }

        checkA( a );
        checkB( a );
        checkC1( a );

        for( int j = 0; j < 9; j++ )
        {
            for( int k = 0; k < 18; k++ )
                cout << a[j][k];
            cout << endl;
        }

    }

    return 0;
}