import java.util.Random;

public class a3Problem2 {

    public static void main(String[] args) {
    	
    	Random rng = new Random();
    	
    	int tortPos = 0;
    	int harePos = 0;
    	int turn = 1;
    	
    	while (tortPos < 100 || harePos < 100) {
    		int randNumTort = rng.nextInt(5);
    		tortPos = tortPos + randNumTort;
    		int randNumHare = rng.nextInt(5);
    		harePos = harePos + randNumHare;
    		System.out.println("Turn: " + turn++);
    		System.out.println("Tortoise position: " + tortPos);
    		System.out.println("Hare position:     " + harePos);
    		System.out.println();
    		if (tortPos >= 100 && harePos >= 100) {
    			System.out.println("It's a tie!");
    			System.exit(0);
    		}
    		else if (tortPos >= 100) {
    			System.out.println("The tortoise wins!");
    			System.exit(0);
    		}
    		else if (harePos >= 100) {
    			System.out.println("The hare wins!");
    			System.exit(0);
    		}
    	}
    	
    }
    
}