import java.util.*;
import java.util.Scanner;
class RandomGroup 
{
public static void main(String[] args)
{
LinkedList<Integer> l=new LinkedList<Integer>();
int[][] group=new int[5][8];
Random r=new Random();
    Scanner input=new Scanner(System.in);
for(int i=0;i<40;i++)
  l.add(new Integer(i+1));
for(int i=0;i<5;i++)
{
  for(int j=0;j<8;j++)
  {
   int k=r.nextInt(l.size());
   group[i][j]=l.get(k);
   l.remove(k);
  } 
}
for(int i=0;i<5;i++)
{
  System.out.print("Group "+(i+1)+": ");
  for(int j=0;j<8;j++)
  {
      if(group[i][j]<10)
   System.out.print("swe00"+group[i][j]+" ");
   else
    System.out.print("swe0"+group[i][j]+" ");
  }
  System.out.println();
}
System.out.print("请输入学生学号最后两位:");
        double Number=input.nextDouble();
        for(int i=0;i<5;i++)
        {
            for(int j=0;j<8;j++)
            {
                if(Number==group[i][j])
                {
                    System.out.println("该学生在第"+(i+1)+"组,该组成员有:");
                    int b;
                    for(int k=0;k<8;k++)
                    {
                        for(int x=k;x<7;x++)
                        {
                            if(group[i][k]>group[i][x+1])
                            {
                                b=group[i][k];
                                group[i][k]=group[i][x+1];
                                group[i][x+1]=b;
                            }    
                        }
    System.out.print("swe00"+group[i][j]+" ");
                    }
                    System.out.println();
                }
                
            }
        }
    }
}