class Res
{
String name;
String sex;
boolean flag=false;
}
class Input implements Runnable
{
private Res r;
Input(Res r)
{
this.r=r;
}
public void run()
{
int x=0;
while(true)
{
if(r.flag)
try{r.wait();}catch(Exception ex){}
if(x==0)
{
r.name="hjy";
r.sex="man"; }
else
{
r.name="丽丽";
r.sex="女女女"; }
x=(x+1)%2;
r.flag=true;
r.notify();

}
}
}
class Output implements Runnable
{
private Res r;
Output(Res r)
{
this.r=r;
}
public void run()
{
while(true)
{
if(!r.flag)
try{r.wait();}catch(Exception ex){}
System.out.println(r.name+"...."+r.sex);
r.flag=false;
r.notify();
}

}
}
class InputOutputDemo
{
public static void main(String[] args) 
{
Res r=new Res();
Input i=new Input(r);
Output o=new Output(r);
Thread t1=new Thread(i);
Thread t2=new Thread(o);
t1.start();
t2.start();
}
}