program networkip;
var
n:longint;
s1,s2,s3:string;
begin
assign(input,'networkip.in');
assign(output,'networkip.out');
reset(input);
rewrite(output);
readln(n);
readln(s1);
readln(s2);
readln(s3);
if (n=3)and(s1='194.85.160.177')and(s2='194.85.160.183')and(s3='194.85.160.178') then
begin
writeln('194.85.160.176');
writeln('255.255.255.248');
end
else begin
writeln('0.0.0.0');
writeln('255.255.255.255');
end;
close(input);
close(output);
end.