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

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

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

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

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

k = A("k")
d = B("d")
h = C("h")
e = D("e")
m = E("m")
c = D("c")
b = B("b")

k.u = b
k.x = c
k.z = c
k.v = h
d.s = m
d.u = b
h.u = m
h.x = m
h.t = m
e.p = c
m.u = b
m.v = c
m.x = k
c.p = e
b.s = m
b.u = d
assert m.x.v.t.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: D = None
        self.z: D = None
        self.v: C = None
        self.txt = txt

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

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

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

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

k = A("k")
d = B("d")
h = C("h")
e = D("e")
m = E("m")
c = D("c")
b = B("b")

k.u = b
k.x = c
k.z = c
k.v = h
d.s = m
d.u = b
h.u = m
h.x = m
h.t = m
e.p = c
m.u = b
m.v = c
m.x = k
c.p = e
b.s = m
b.u = d
assert m.x.v.t.u.u.u.u.txt == "d"