import java.io.*;
//import java.util.*;

public class SGMLFormater {
    
    public static final boolean DEBUG = false;

    private static int sysid = 1;

    public static void main(String[] args) {
	
	try {
	    FileInputStream fis = new FileInputStream(args[0]);
	    InputStreamReader isr = new InputStreamReader(fis);
	    BufferedReader in = new BufferedReader(isr);

	    System.out.print("<refset setid=\"testref.sgm\" srclang=\"Hindi\" trglang=\"English\">\n");

	    // Read the file, build the arrays
	    int size = (new Integer(in.readLine())).intValue();
	    for(int i=0; i < size; i++) {
		String thisLine = in.readLine();
		System.out.print( sgmlFormat(thisLine) + "\n" );
	    }
	} catch(Exception e) {
	    e.printStackTrace();
	    System.exit(0);
	}
    }

    public static String sgmlFormat( String line ) {
	String ret = "<DOC docid=\"1\" sysid=\"E" + sysid + "\"> <p>\n<seg id=1>"+line+"</seg>\n</p> </DOC>\n";
	sysid++;
	return ret;
    }
}
