import java.lang.String;
import java.lang.Integer;

sealed interface List permits LinkedElem, Elem {}


public record LinkedElem<T>(T a,List l) implements List{}
public record Elem<T>(T c) implements List{}

public class GenericRecordSwitchCase {
    public main(o) {
         return switch(o) {
                case LinkedElem(a, Elem(e)) -> a ;
                case LinkedElem(a, LinkedElem(e, Elem(f))) -> a;
         };
    }
}







