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

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

class C:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: C = None
        self.y: C = None
        self.t: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.p: A = None
        self.z: B = None
        self.txt = txt

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

n = A("n")
a = B("a")
c = C("c")
g = D("g")
h = E("h")
m = D("m")
l = A("l")
d = C("d")
b = E("b")

n.x = m
n.z = c
n.p = b
a.z = c
a.s = n
a.x = m
c.w = d
c.u = d
c.y = d
c.t = d
g.s = h
g.p = l
g.z = a
h.p = b
h.y = m
m.s = h
m.p = n
m.z = a
l.x = m
l.z = c
l.p = h
d.w = c
d.u = c
d.y = c
d.t = c
b.p = h
b.y = g
assert a.s.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: C = None
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: C = None
        self.y: C = None
        self.t: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.p: A = None
        self.z: B = None
        self.txt = txt

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

n = A("n")
a = B("a")
c = C("c")
g = D("g")
h = E("h")
m = D("m")
l = A("l")
d = C("d")
b = E("b")

n.x = m
n.z = c
n.p = b
a.z = c
a.s = n
a.x = m
c.w = d
c.u = d
c.y = d
c.t = d
g.s = h
g.p = l
g.z = a
h.p = b
h.y = m
m.s = h
m.p = n
m.z = a
l.x = m
l.z = c
l.p = h
d.w = c
d.u = c
d.y = c
d.t = c
b.p = h
b.y = g
assert a.s.z.u.txt == "d"