[ ['a', 'a', 'a'], ['a', 'a', 'a'], ['a', 'a', 'a']],
[['a', 'a', 'a'], ['a', 'a', 'a'], ['a', 'a', 'b']],
[['a', 'a', 'a'], ['a', 'a', 'a'], ['a', 'b', 'b']],
...,
[ ['a', 'b', 'c'], ['a', 'b', 'c'], ['a', 'b', 'c']],
...,
[ ['c', 'c', 'c'], ['c', 'c', 'c'], ['c', 'c', 'c']]
print list(itertools.product(['a', 'b', 'c'], repeat=9))
char[,] matr=new char[3,3];
for(int i=0;i<19683;i++){
int a=i;
for(int j=9;--j>=0;){
matr[j/3,j%3]=(char)('a'+a%3);
a/=3;
}
Process(matr);
}
#!/usr/bin/python
s = ['a','a','a','a','a','a','a','a','a']
print s
def plus(s):
i = -1
cf = 1
while cf == 1:
if (s[i] == 'a'):
cf = 0
s[i] = 'b'
elif s[i] == 'b':
cf = 0
s[i] = 'c'
elif (s[i] == 'c'):
cf = 1
s[i] = 'a'
i -= 1
while s != ['c','c','c','c','c','c','c','c','c']:
plus(s)
print s