#!/usr/bin/env python3 with open('valos_halozat.txt') as halozat: halozat.readline() sorok=int(halozat.readline()) for _ in range(sorok): hal = halozat.readline() print(f"{list(filter(None, hal.split(' ')))[0]} {list(filter(None, hal.split(' ')))[1]}")