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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

e = A("e")
j = B("j")
m = C("m")
a = D("a")
n = E("n")
c = E("c")
d = D("d")
b = A("b")

e.z = m
e.u = d
j.y = c
j.p = m
m.x = a
a.o = m
n.o = m
n.q = b
c.o = m
c.q = b
d.o = m
b.z = m
b.u = a
assert a.o.x.o.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

e = A("e")
j = B("j")
m = C("m")
a = D("a")
n = E("n")
c = E("c")
d = D("d")
b = A("b")

e.z = m
e.u = d
j.y = c
j.p = m
m.x = a
a.o = m
n.o = m
n.q = b
c.o = m
c.q = b
d.o = m
b.z = m
b.u = a
assert a.o.x.o.x.o.txt == "m"