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

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

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

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

k = A("k")
m = B("m")
b = C("b")
a = D("a")
h = B("h")
l = C("l")
e = B("e")

k.z = l
m.z = l
m.y = a
m.s = a
m.v = a
b.s = l
a.s = k
a.t = b
a.u = h
h.z = b
h.y = a
h.s = a
h.v = a
l.s = b
e.z = b
e.y = a
e.s = a
e.v = a
assert a.u.y.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

k = A("k")
m = B("m")
b = C("b")
a = D("a")
h = B("h")
l = C("l")
e = B("e")

k.z = l
m.z = l
m.y = a
m.s = a
m.v = a
b.s = l
a.s = k
a.t = b
a.u = h
h.z = b
h.y = a
h.s = a
h.v = a
l.s = b
e.z = b
e.y = a
e.s = a
e.v = a
assert a.u.y.u.z.txt == "b"