class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: A = None
        self.y: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

e = A("e")
l = B("l")
n = C("n")
a = C("a")
c = C("c")
h = A("h")
b = B("b")
i = A("i")

e.o = h
l.o = b
l.y = b
l.s = e
n.v = h
a.v = e
c.v = i
h.o = e
b.o = l
b.y = l
b.s = i
i.o = e
assert l.s.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: A = None
        self.y: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

e = A("e")
l = B("l")
n = C("n")
a = C("a")
c = C("c")
h = A("h")
b = B("b")
i = A("i")

e.o = h
l.o = b
l.y = b
l.s = e
n.v = h
a.v = e
c.v = i
h.o = e
b.o = l
b.y = l
b.s = i
i.o = e
assert l.s.o.o.txt == "e"