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

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: E = None
        self.t: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

i = A("i")
m = B("m")
l = C("l")
g = D("g")
c = E("c")
j = C("j")

i.z = j
i.u = g
i.w = m
m.q = i
m.v = c
l.p = i
l.x = i
l.u = j
l.z = g
g.u = m
g.q = c
g.t = c
c.u = l
j.p = i
j.x = i
j.u = l
j.z = g
assert m.q.z.u.u.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: D = None
        self.w: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: E = None
        self.t: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

i = A("i")
m = B("m")
l = C("l")
g = D("g")
c = E("c")
j = C("j")

i.z = j
i.u = g
i.w = m
m.q = i
m.v = c
l.p = i
l.x = i
l.u = j
l.z = g
g.u = m
g.q = c
g.t = c
c.u = l
j.p = i
j.x = i
j.u = l
j.z = g
assert m.q.z.u.u.x.u.txt == "g"