program hoge
implicit none
integer :: x, y, ios
character(len=100) :: str
open(unit=11, file="input.txt", status="OLD")
open(unit=12, file="output.txt", status="UNKNOWN")
do
read(11, "(A)", iostat=ios) str
if (ios /= 0) exit
read(str, *, iostat=ios) x, y
if ((ios /= 0) .or. ((x <= 123) .and. (y <= 32))) then
write(12, "(A)") trim(str)
end if
end do
close(11)
close(12)
end program hoge