

class Notifyer extends Thread
{
  Object caller;


  public Notifyer(Object caller)
  {
    System.out.println("Notifyer");
    this.caller=caller;
    this.start();
  }

  public void run()
  {
    while (true) 
    {
      synchronized (this) 
      {
        try 
        {
          this.wait(60);
        }
        catch (InterruptedException e) {;}
      }
      synchronized (caller) 
      {
        caller.notify();
      }
    }
  }
}




public class NotifyTest extends Thread
{
  String name;
  int timeOutTime;

  public NotifyTest(String name, int timeOutTime)
  {
    System.out.println("NotifyTest");
    this.name=name;
    this.timeOutTime=timeOutTime;
    this.start();
  }

  public void run()
  {
    int i=0;
    while (true) 
    {
      synchronized (this) 
      {
        try 
        {
          this.wait(timeOutTime);
        }
        catch (InterruptedException e) {;}
      }
      if (++i>=1000) {System.out.print(name);i=0;}
    }
  }


  public static void main(String[] args) 
  {
    System.out.println("hello");
    Object o1=new NotifyTest(".",Integer.parseInt(args[0]));
    Object o2=new NotifyTest(",",Integer.parseInt(args[1]));
    new Notifyer(o1);
    new Notifyer(o1);
    new Notifyer(o2);
  }
}


