END{h="\n---+---+---\n" for(t="1|9|4"h"7|2|9"h"5|6|3\n";sub(++i,i%2?" X ":" O ",t);){$0=t gsub(/[0-9]/," ") print}}