import java.io.*;

public class Cat
{
	public static void main(String[] argv)
	{
		boolean squash = false, number = false; // flags to modify output
		try // Exceptions may occur, so we wrap things in a try­block
		{
			int i = 0;
			for (; i<argv.length; i++)
			{
				if(argv[i].equals("-s"))
				{
					squash = true;
				}
				else if(argv[i].equals("-n"))
				{
					number = true;
					System.out.println(argv[i]);
				}
				else break;
			}

			// Choose the appropriate output writer 
			PrintWriter out = number ? new LineNumberWriter(System.out) : new PrintWriter(System.out); 
			for (; i<argv.length; i++)
			{
				// Choose the appropriate input reader
				LineNumberReader r = squash ? new BlankFilterReader(new FileReader(argv[i])) : new LineNumberReader (new FileReader(argv[i]));
				// Copy the input to the output 
				String line = r.readLine();
				while (line!=null)
				{
					out.println(line);
					line = r.readLine();
				}
				r.close();
			}
			out.close();
		} // this is the end of the try­block, we now catch Exceptions
		catch (Exception e)
		{
			System.err.println(e);
			System.exit(0); // Bale out
		}
	}
}

class BlankFilterReader extends LineNumberReader
{
	private boolean m_bLineCached = false;
	private String m_cachedLine = null;

	private static boolean is_blank(String s)
	{
		return s != null && s.equals("");
	}

	BlankFilterReader(Reader r)
	{
		super(r);
	}

	public String readLine() throws IOException
	{
		if(m_bLineCached)
		{
			// We read a series of blank lines, and we know we got to the end of them because we read a non-blank one, which we
			// cached last time.
			m_bLineCached = false;
			return m_cachedLine;
		}
		else
		{
			String s = super.readLine();
			if(!is_blank(s))
			{
				return s;
			}
			else
			{
				// If this one's a blank, keep reading until we encounter a non-blank one or null. Cache that, and return a
				// single blank line as the result.
				do
				{
					s = super.readLine();
				} while(is_blank(s));

				m_bLineCached = true;
				m_cachedLine = s;
				return new String("");
			}
		}
	}
}

class LineNumberWriter extends PrintWriter
{
	private int m_iLineCount = 1;

	LineNumberWriter(OutputStream os)
	{
		super(os);
	}

	public void println(String s)
	{
		super.print(m_iLineCount + ":\t" + s);
		super.println();
		++m_iLineCount;
	}
}