/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;


class CellHelper<T> {
	final T[] mValues;
	final Class<T> cls;
	public CellHelper(T[] values, Class<T> c) {
		mValues = values;
		cls = c;
	}
	public T getCell(int index) {
		if (index < mValues.length ) {
            return mValues[index];              
        }
        throw new IllegalArgumentException("Invalid " + cls.getSimpleName() + " value: " + index);
	}
}

enum SomeEnumClass {
    ONE(1), TWO(2), THREE(3);
    SomeEnumClass(int n){}
    private static  final CellHelper<SomeEnumClass> helper = new CellHelper(SomeEnumClass.values(), SomeEnumClass.class);
    public static SomeEnumClass getCell(int i) {return helper.getCell(i);}
}

enum OtherEnumClass {
    Monday(1), Tuesday(2), Wednesday(3), Thrusday(4), Friday(5), Saturday(6), Sunday(7);
    OtherEnumClass(int n){}
    private static  final CellHelper<OtherEnumClass> helper = new CellHelper(OtherEnumClass.values(), OtherEnumClass.class);
    public static OtherEnumClass getCell(int i) {return helper.getCell(i);}


}

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		System.out.println(SomeEnumClass.getCell(1));
		System.out.println(OtherEnumClass.getCell(1));
	}
}