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

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: D = None
        self.o: D = None
        self.txt = txt

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

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

k = A("k")
n = B("n")
f = C("f")
d = D("d")
g = C("g")
e = D("e")
m = C("m")
c = A("c")

k.z = n
n.y = g
n.w = d
n.o = e
f.o = k
f.u = m
d.z = n
d.s = n
d.u = c
d.o = f
g.o = c
g.u = f
e.z = n
e.s = n
e.u = k
e.o = g
m.o = c
m.u = g
c.z = n
assert m.o.z.y.u.u.o.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: D = None
        self.o: D = None
        self.txt = txt

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

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

k = A("k")
n = B("n")
f = C("f")
d = D("d")
g = C("g")
e = D("e")
m = C("m")
c = A("c")

k.z = n
n.y = g
n.w = d
n.o = e
f.o = k
f.u = m
d.z = n
d.s = n
d.u = c
d.o = f
g.o = c
g.u = f
e.z = n
e.s = n
e.u = k
e.o = g
m.o = c
m.u = g
c.z = n
assert m.o.z.y.u.u.o.z.w.txt == "d"