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

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

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

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

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

n.z = e
n.y = e
b.u = i
f.v = i
f.y = b
d.t = i
d.u = k
d.y = b
m.t = i
m.u = f
m.y = b
e.z = n
e.y = n
k.v = m
k.y = b
i.t = d
i.u = k
i.y = b
assert d.y.u.y.u.y.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: A = None
        self.txt = txt

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

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

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

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

n.z = e
n.y = e
b.u = i
f.v = i
f.y = b
d.t = i
d.u = k
d.y = b
m.t = i
m.u = f
m.y = b
e.z = n
e.y = n
k.v = m
k.y = b
i.t = d
i.u = k
i.y = b
assert d.y.u.y.u.y.u.u.txt == "k"