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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: B = None
        self.u: B = None
        self.s: A = None
        self.p: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: B = None
        self.w: A = None
        self.txt = txt

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

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

b.x = j
j.y = b
j.z = b
j.o = d
m.w = j
m.v = j
m.u = j
m.s = b
m.p = n
l.r = j
l.y = j
l.w = b
d.y = c
d.o = b
d.q = b
n.w = j
n.v = j
n.u = j
n.s = b
n.p = m
c.y = d
c.o = b
c.q = b
assert d.o.x.z.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.v: B = None
        self.u: B = None
        self.s: A = None
        self.p: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: B = None
        self.w: A = None
        self.txt = txt

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

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

b.x = j
j.y = b
j.z = b
j.o = d
m.w = j
m.v = j
m.u = j
m.s = b
m.p = n
l.r = j
l.y = j
l.w = b
d.y = c
d.o = b
d.q = b
n.w = j
n.v = j
n.u = j
n.s = b
n.p = m
c.y = d
c.o = b
c.q = b
assert d.o.x.z.x.o.txt == "d"