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

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

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

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

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

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

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

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

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

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

l.y = m
l.t = e
e.y = n
m.r = e
m.q = e
m.z = e
k.z = b
k.v = l
k.w = m
n.r = e
n.q = e
n.z = e
b.r = e
b.q = e
b.z = e
assert l.t.y.z.txt == "e"