import java.io.*;
import java.util.*;
import java.awt.*;
class TryThread
{
   public static void main(String args[])
   {
      new TryThread().Go();
   }

   void Go()
   {
      Thread t1, t2;
      MyThread s1,s2,s3;
      s1 = new MyThread("T1", this);
      t1 = new Thread(s1);
      s2 = new MyThread("T2", this);
      t2 = new Thread(s2);
      t1.start();
      t2.start();
      new Thread(new MyThread("T3", this)).start() ;
   }

   int xxx = 10;
   //public synchronized void Doit(MyThread t)
   public void Doit(MyThread t)
   {
      System.out.print (++xxx);
      System.out.println(t.ss);
   }
}

class MyThread implements Runnable
{
   String ss;
   TryThread thr;
   MyThread ( String s, TryThread thr1 )
      { ss = s; thr = thr1;}
   public void run()
   {
         thr.Doit(this);
   }
}
// Output with synchronized commented out
//
//1112T2
//13T3
//T1
//
// Output with synchronized Doit
//
//11T1
//12T2
//13T3
