sudoku(L) :-
   L = [X11,X12,X13,X14,X15,X16,X17,X18,X19,
        X21,X22,X23,X24,X25,X26,X27,X28,X29,
        X31,X32,X33,X34,X35,X36,X37,X38,X39,
        X41,X42,X43,X44,X45,X46,X47,X48,X49,
        X51,X52,X53,X54,X55,X56,X57,X58,X59,
        X61,X62,X63,X64,X65,X66,X67,X68,X69,
        X71,X72,X73,X74,X75,X76,X77,X78,X79,
        X81,X82,X83,X84,X85,X86,X87,X88,X89,
        X91,X92,X93,X94,X95,X96,X97,X98,X99],
   fd_domain(L,1,9),
   fd_all_different([X11,X12,X13,X14,X15,X16,X17,X18,X19]),
   fd_all_different([X21,X22,X23,X24,X25,X26,X27,X28,X29]),
   fd_all_different([X31,X32,X33,X34,X35,X36,X37,X38,X39]),
   fd_all_different([X41,X42,X43,X44,X45,X46,X47,X48,X49]),
   fd_all_different([X51,X52,X53,X54,X55,X56,X57,X58,X59]),
   fd_all_different([X61,X62,X63,X64,X65,X66,X67,X68,X69]),
   fd_all_different([X71,X72,X73,X74,X75,X76,X77,X78,X79]),
   fd_all_different([X81,X82,X83,X84,X85,X86,X87,X88,X89]),
   fd_all_different([X91,X92,X93,X94,X95,X96,X97,X98,X99]),
   fd_all_different([X11,X21,X31,X41,X51,X61,X71,X81,X91]),
   fd_all_different([X12,X22,X32,X42,X52,X62,X72,X82,X92]),
   fd_all_different([X13,X23,X33,X43,X53,X63,X73,X83,X93]),
   fd_all_different([X14,X24,X34,X44,X54,X64,X74,X84,X94]),
   fd_all_different([X15,X25,X35,X45,X55,X65,X75,X85,X95]),
   fd_all_different([X16,X26,X36,X46,X56,X66,X76,X86,X96]),
   fd_all_different([X17,X27,X37,X47,X57,X67,X77,X87,X97]),
   fd_all_different([X18,X28,X38,X48,X58,X68,X78,X88,X98]),
   fd_all_different([X19,X29,X39,X49,X59,X69,X79,X89,X99]),
   fd_all_different([X11,X12,X13,X21,X22,X23,X31,X32,X33]),
   fd_all_different([X14,X15,X16,X24,X25,X26,X34,X35,X36]),
   fd_all_different([X17,X18,X19,X27,X28,X29,X37,X38,X39]),
   fd_all_different([X41,X42,X43,X51,X52,X53,X61,X62,X63]),
   fd_all_different([X44,X45,X46,X54,X55,X56,X64,X65,X66]),
   fd_all_different([X47,X48,X49,X57,X58,X59,X67,X68,X69]),
   fd_all_different([X71,X72,X73,X81,X82,X83,X91,X92,X93]),
   fd_all_different([X74,X75,X76,X84,X85,X86,X94,X95,X96]),
   fd_all_different([X77,X78,X79,X87,X88,X89,X97,X98,X99]),
   fd_labeling(L),
   write(X11), write(' '), write(X12), write(' '),write(X13), write('  '),
   write(X14), write(' '), write(X15), write(' '),write(X16), write('  '),
   write(X17), write(' '), write(X18), write(' '),write(X19), nl,
   write(X21), write(' '), write(X22), write(' '),write(X23), write('  '),
  write(X24), write(' '), write(X25), write(' '),write(X26), write('  '),
   write(X27), write(' '), write(X28), write(' '),write(X29), nl,
   write(X31), write(' '), write(X32), write(' '),write(X33), write('  '),
   write(X34), write(' '), write(X35), write(' '),write(X36), write('  '),
   write(X37), write(' '), write(X38), write(' '),write(X39), nl,
write(X41), write(' '), write(X42), write(' '),write(X43), write('  '),
   write(X44), write(' '), write(X45), write(' '),write(X46), write('  '),
   write(X47), write(' '), write(X48), write(' '),write(X49), nl,
write(X51), write(' '), write(X52), write(' '),write(X53), write('  '),
   write(X54), write(' '), write(X55), write(' '),write(X56), write('  '),
   write(X57), write(' '), write(X58), write(' '),write(X59), nl,
write(X61), write(' '), write(X62), write(' '),write(X63), write('  '),
   write(X64), write(' '), write(X65), write(' '),write(X66), write('  '),
   write(X67), write(' '), write(X68), write(' '),write(X69), nl,
write(X71), write(' '), write(X72), write(' '),write(X73), write('  '),
   write(X74), write(' '), write(X75), write(' '),write(X76), write('  '),
   write(X77), write(' '), write(X78), write(' '),write(X79), nl,
write(X81), write(' '), write(X82), write(' '),write(X83), write('  '),
   write(X84), write(' '), write(X85), write(' '),write(X86), write('  '),
   write(X87), write(' '), write(X88), write(' '),write(X89), nl,
write(X91), write(' '), write(X92), write(' '),write(X93), write('  '),
   write(X94), write(' '), write(X95), write(' '),write(X96), write('  '),
 write(X97), write(' '), write(X98), write(' '),write(X99), nl.

sendmore(L):-
        L=[S,E,N,D,M,O,R,Y],
        fd_domain([S,E,N,D,M,O,R,Y],0,9),
        fd_domain([S,M],1,9),
        1000*S+100*E+10*N+D + 1000*M+100*O+10*R+E #= 10000*M+1000*O+100*N+10*E+Y,
        fd_all_different(L),
        fd_labeling(L).


