int main(){write(sort(map(enumerate(720),lambda(int x){return Array.permute("012345"/1,x)*" ";}))*"\n");}