Find the smallest, largest and medium number by comparing 3 array list

How do I compare 3 Arraylist with each other and find the small, medium and large elements. I was thinking something like this but its not working.

ArrayList<interger> a = new ArrayList<ArrayList<interger> >(); 
a.add(1);
a.add(2);
a.add(7);
ArrayList<interger> b =new ArrayList<ArrayList<interger> >();
b.add(8);
b.add(9);
b.add(1);
ArrayList<interger> c = new ArrayList<ArrayList<interger> >();
c.add(5);
c.add(9)
c.add(8)

 for (int i = 0; i < ; i++) 
        {
            for (int j = 0; j < ; j++) 
            {
                for (int k = 0; k < ; k++) 
                {

        if () {}

        if () {}    

        if () {}
         }
      }}

output:
small =1,2,1
medium = 5,9,7
large = 8,9,8