#!/usr/bin/perl -w

$col1 = $ARGV[0];
$col2 = $ARGV[1];
#print "==> $col1\n";

while ($line = <STDIN>) {
    chomp($line);
    @cols = split(/ & /, $line);
    $tmp = $cols[$col1];
    $cols[$col1] = $cols[$col2];
    $cols[$col2] = $tmp;

    $newline = join(" & ", @cols);
    print "$newline\n";
}
