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

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

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

j = A("j")
c = B("c")
i = C("i")
e = A("e")
m = B("m")
g = A("g")
h = C("h")
b = A("b")

j.u = c
j.o = h
c.z = g
c.q = h
c.y = j
i.o = h
i.y = e
e.u = c
e.o = h
m.z = g
m.q = h
m.y = b
g.u = c
g.o = h
h.o = i
h.y = j
b.u = m
b.o = h
assert e.o.y.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.o: C = None
        self.txt = txt

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

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

j = A("j")
c = B("c")
i = C("i")
e = A("e")
m = B("m")
g = A("g")
h = C("h")
b = A("b")

j.u = c
j.o = h
c.z = g
c.q = h
c.y = j
i.o = h
i.y = e
e.u = c
e.o = h
m.z = g
m.q = h
m.y = b
g.u = c
g.o = h
h.o = i
h.y = j
b.u = m
b.o = h
assert e.o.y.o.o.txt == "i"