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

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: C = None
        self.txt = txt

e = A("e")
h = B("h")
a = C("a")
i = B("i")
n = C("n")
k = B("k")

e.o = n
h.o = a
a.s = i
a.q = n
i.o = n
n.s = i
n.q = a
k.o = n
assert a.s.o.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: C = None
        self.txt = txt

e = A("e")
h = B("h")
a = C("a")
i = B("i")
n = C("n")
k = B("k")

e.o = n
h.o = a
a.s = i
a.q = n
i.o = n
n.s = i
n.q = a
k.o = n
assert a.s.o.q.q.txt == "n"