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

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

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

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

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

f = A("f")
l = B("l")
n = C("n")
j = D("j")
d = E("d")
m = D("m")

f.w = l
f.r = m
f.t = j
l.t = n
l.z = n
l.s = n
l.v = f
n.p = d
n.r = j
n.w = j
n.x = j
n.u = f
j.t = f
j.w = l
d.t = f
d.x = f
m.t = f
m.w = l
assert n.p.t.w.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: D = None
        self.t: D = None
        self.txt = txt

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

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

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

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

f = A("f")
l = B("l")
n = C("n")
j = D("j")
d = E("d")
m = D("m")

f.w = l
f.r = m
f.t = j
l.t = n
l.z = n
l.s = n
l.v = f
n.p = d
n.r = j
n.w = j
n.x = j
n.u = f
j.t = f
j.w = l
d.t = f
d.x = f
m.t = f
m.w = l
assert n.p.t.w.s.u.txt == "f"