#!perl -lpaF sub f{$r+=print map+($r<2?$_<5^$r:$_%5^$r-2)?'<->':' | ',@F}$n=s/./===/g;print;f f;print map--$n%4?'===':'=*=',@F;f f f f f