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

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

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

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

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

a = A("a")
h = B("h")
f = C("f")
n = D("n")
b = E("b")
m = A("m")
j = E("j")

a.t = m
a.z = n
a.x = h
h.x = a
h.q = m
h.u = f
f.z = n
f.p = h
n.u = f
n.q = f
n.w = b
n.s = m
b.y = f
b.s = n
m.t = a
m.z = n
m.x = h
j.y = f
j.s = n
assert n.s.z.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: D = None
        self.x: B = None
        self.txt = txt

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

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

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

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

a = A("a")
h = B("h")
f = C("f")
n = D("n")
b = E("b")
m = A("m")
j = E("j")

a.t = m
a.z = n
a.x = h
h.x = a
h.q = m
h.u = f
f.z = n
f.p = h
n.u = f
n.q = f
n.w = b
n.s = m
b.y = f
b.s = n
m.t = a
m.z = n
m.x = h
j.y = f
j.s = n
assert n.s.z.u.z.txt == "n"