#!/usr/bin/perl -w

use strict;

my $N = '123456789';

for my $x (1 .. 7) {
  for my $y (1 .. (9 - $x - 1)) {
    for my $z (1 .. (9 - $x - $y - 1)) {
      #print "$x,$y,$z\n";
      $N =~ /^(.{$x})(.{$y})(.{$z})(.+)$/ or die;
      my $l = join("\t",($1+$2-$3-$4,$1-$2+$3-$4,$1-$2-$3+$4));
      print "$1,$2,$3,$4=\t$l\n";
      }}}

