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

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

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

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

m = A("m")
l = B("l")
a = C("a")
j = D("j")
d = A("d")
k = B("k")
f = A("f")

m.w = a
m.r = a
m.z = j
l.y = k
l.t = j
l.r = a
a.s = j
j.s = l
d.w = a
d.r = a
d.z = j
k.y = l
k.t = j
k.r = a
f.w = a
f.r = a
f.z = j
assert l.y.r.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: C = None
        self.z: D = None
        self.txt = txt

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

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

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

m = A("m")
l = B("l")
a = C("a")
j = D("j")
d = A("d")
k = B("k")
f = A("f")

m.w = a
m.r = a
m.z = j
l.y = k
l.t = j
l.r = a
a.s = j
j.s = l
d.w = a
d.r = a
d.z = j
k.y = l
k.t = j
k.r = a
f.w = a
f.r = a
f.z = j
assert l.y.r.s.s.txt == "l"