// Arup Guha
// 6/13/2019
// Written to create teams for SI@UCF Design Contest (Week #1)
import java.util.*;

public class MakeTeams {

	// Students in class and team sizes.
	final public static String[] NAMES = {"Dogan", "Serena", "Collier", "Nathanael", "Rishi", "Suhas", "Jackson"};
	final public static int[] teamSizes = {2,2,3};
	
	public static void main(String[] args) {
		
		Random r = new Random();
		boolean[] used = new boolean[NAMES.length];
		
		// Go through each team.
		for (int i=0; i<teamSizes.length; i++) {
			
			// Will store team i here.
			ArrayList<String> thisTeam = new ArrayList<String>();
			
			// Keep on going until the team is filled.
			while (thisTeam.size() < teamSizes[i]) {
				
				// Generate a random person.
				int idx = r.nextInt(NAMES.length);
				
				// Already has a team, try again.
				if (used[idx]) continue;
				
				// Mark this person as being on a team and add them.
				used[idx] = true;
				thisTeam.add(NAMES[idx]);
			}
			
			// Print this team.
			System.out.print("Team "+i+":");
			for (String s: thisTeam) System.out.print(" "+s);
			System.out.println();
		}
	}
}