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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: A = None
        self.t: B = None
        self.x: A = None
        self.q: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

j.u = f
j.z = l
j.s = l
m.y = j
m.p = j
m.x = j
m.t = b
m.q = l
f.s = m
l.z = f
l.v = b
a.x = b
a.s = b
a.u = j
a.v = c
a.p = f
d.x = b
d.u = j
d.v = c
d.s = m
d.p = f
b.y = j
b.p = j
b.x = j
b.t = m
b.q = l
c.x = m
c.s = m
c.u = j
c.v = a
c.p = f
assert m.t.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: D = None
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: A = None
        self.t: B = None
        self.x: A = None
        self.q: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

j.u = f
j.z = l
j.s = l
m.y = j
m.p = j
m.x = j
m.t = b
m.q = l
f.s = m
l.z = f
l.v = b
a.x = b
a.s = b
a.u = j
a.v = c
a.p = f
d.x = b
d.u = j
d.v = c
d.s = m
d.p = f
b.y = j
b.p = j
b.x = j
b.t = m
b.q = l
c.x = m
c.s = m
c.u = j
c.v = a
c.p = f
assert m.t.q.z.txt == "f"