##################################
#                                #
# Last modified 2017/08/07       # 
#                                #
# Georgi Marinov                 #
#                                # 
##################################

import sys
import math
import string

def run():

    if len(sys.argv) < 1:
        print 'usage: python %s ' % sys.argv[0]
        print '\tthe script assumes reading a samtools streams from stdin and will print to stdout'
        sys.exit(1)

    linelist = sys.stdin
    for alignedread in linelist:
        fields=str(alignedread).split('\t')
        if 'N' in fields[5]:
            print alignedread

run()

