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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

m = A("m")
e = B("e")
b = C("b")
f = D("f")
n = A("n")
k = D("k")
a = A("a")

m.w = e
m.u = b
m.r = b
e.r = b
b.y = n
b.p = f
f.z = b
f.w = b
f.v = k
n.w = e
n.u = b
n.r = b
k.z = b
k.w = b
k.v = f
a.w = e
a.u = b
a.r = b
assert b.y.w.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: C = None
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

m = A("m")
e = B("e")
b = C("b")
f = D("f")
n = A("n")
k = D("k")
a = A("a")

m.w = e
m.u = b
m.r = b
e.r = b
b.y = n
b.p = f
f.z = b
f.w = b
f.v = k
n.w = e
n.u = b
n.r = b
k.z = b
k.w = b
k.v = f
a.w = e
a.u = b
a.r = b
assert b.y.w.r.p.txt == "f"