#!/usr/bin/perl -w
use strict;
while(<STDIN>) {
    s/\s+//g;
    if (/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})-(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/){
        if ($1 == $5 and $2 == $6 and $3 == $7) {
            my ($start,$end) = ($4,$8);
            for($start..$end){
                print join('.',$1,$2,$3,$_) . "\n";
            }
        }
    }
    elsif (/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/) {
        print "$1\n"
    }
    else  { }
}
