import java.lang.*;

public class TextLine implements Comparable<TextLine>
{
  int lineNum;
  String contents;

  public TextLine(int n, String s)
  {
    if(n <= 0)
      throw new IllegalArgumentException("Line number must be positive.");
    this.lineNum = n;
    this.contents = s;
  }

  public int getLineNum()
  {
    return this.lineNum;
  }

  public String getContents()
  {
    return this.contents;
  }

  public void setLineNum(int n)
  {
    if(n <= 0)
      throw new IllegalArgumentException("Line number must be positive.");
    this.lineNum = n;
  }

  public void setContents(String s)
  {
    this.contents = s;
  }

  public String toString()
  {
    return this.lineNum + " " + contents;
  }

  public int compareTo(TextLine rhs)
  {
    return this.lineNum - rhs.lineNum;
  }


  public static void main(String args[])
  {
    TextLine t1 = new TextLine(10, "Hello there");
    TextLine t2 = new TextLine(20, "How are you");
    System.out.println(t1 + "\n" + t2);
  }
      
}
   
     
