##################################
#                                #
# Last modified 2018/01/31       # 
#                                #
# Georgi Marinov                 #
#                                # 
##################################

import sys
import string
import math

def run():

    if len(sys.argv) < 1:
        print 'usage: python %s input' % sys.argv[0]
        print '\tUse - for stdin'
        print '\tThe script will print to stdout by default'
        sys.exit(1)
    
    input = sys.argv[1]

    if input == '-':
        lineslist = sys.stdin
    else:
        lineslist = open(input)
    for line in lineslist:
        if line.startswith('fixedStep'):
            chr=line.split(' ')[1].split('=')[1]
            currentPos=int(line.split(' ')[2].split('=')[1])
            continue
        score=line.split('\n')[0]
        outline = chr + '\t' + str(currentPos) + '\t' + str(currentPos+1) + '\t' + score
        print outline
        currentPos+=1

run()
