my $n = shift || 10 ;
my $m = shift || 10 ;
print "$n $m\n" ;
for ($i=0; $i<$m; $i++) {
   while (1) {
      $st = 1 + int rand 1e6 ;
      $et = 1 + int rand 1e6 ;
      if ($et < $st) {
         ($st, $et) = ($et, $st) ;
      }
      next if $seen{$et} || $seen{$st} ;
      $seen{$et}++ ;
      $seen{$st}++ ;
      last ;
   }
   my $sc = 1 + int rand $n ;
   my $ec = 1 + int rand $n ;
   print "$sc $ec $st $et\n" ;
}
