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

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

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

h = A("h")
b = B("b")
i = C("i")
j = B("j")
n = C("n")
l = C("l")
g = B("g")
e = A("e")

h.o = e
b.q = h
i.o = e
j.q = e
n.o = h
l.o = e
g.q = h
e.o = h
assert e.o.o.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.q: A = None
        self.txt = txt

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

h = A("h")
b = B("b")
i = C("i")
j = B("j")
n = C("n")
l = C("l")
g = B("g")
e = A("e")

h.o = e
b.q = h
i.o = e
j.q = e
n.o = h
l.o = e
g.q = h
e.o = h
assert e.o.o.o.o.txt == "e"