def METHOD_NAME(f_ins, f_out):
    print('Output passages...')
    output = open(f_out, 'w')
    output_id = open(f_out.replace(".json", ".id"), 'w')
    max_len = 0
    total_len = 0
    counter = 0
    for f_in in f_ins:
        with gzip.open(f_in, 'rt', encoding='utf8') as in_fh:
            for json_string in tqdm(in_fh):
                input_dict = json.loads(json_string)
                docid = input_dict['docid']
                pid = input_dict['pid']
                passage = input_dict['passage']
                passage_len = len(input_dict['passage'])
                doc_url = docid_to_url[docid]
                doc_title = docid_to_title[docid]
                doc_headings = docid_to_headings[docid]
                docid_to_pass_num[docid]+=1
                total_len += passage_len
                if (passage_len > max_len):
                    max_len = passage_len
                counter+=1
                output_dict = input_dict
                output_dict['url'] = doc_url
                output_dict['title'] = doc_title
                output_dict['headings'] = doc_headings
                output.write(json.dumps(output_dict) + '\n')  
                output_id.write(pid+'\n')
    print('maximum passage length: {}'.format(max_len))
    print('average passage length: {}'.format(total_len/counter))
    output.close()
    output_id.close()
    print('Done!')