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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: D = None
        self.s: A = None
        self.p: A = None
        self.v: A = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: D = None
        self.s: A = None
        self.p: A = None
        self.v: A = None
        self.txt = txt

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

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

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

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

f.u = m
f.x = k
f.o = n
k.t = f
k.s = f
k.p = f
k.v = f
k.r = n
m.p = k
m.s = n
n.x = f
n.t = k
n.o = k
n.p = b
n.v = b
b.z = m
d.p = k
d.s = n
a.z = h
h.p = k
h.s = n
assert f.u.s.v.z.s.txt == "n"