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

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

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

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

j = A("j")
b = B("b")
f = C("f")
m = D("m")
i = B("i")
e = C("e")
l = D("l")

j.s = b
j.y = b
j.v = i
j.z = i
b.r = i
f.s = i
f.x = l
m.w = l
m.v = i
i.r = b
e.s = b
e.x = m
l.w = m
l.v = b
assert m.w.v.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.v: B = None
        self.y: B = None
        self.z: B = None
        self.txt = txt

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

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

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

j = A("j")
b = B("b")
f = C("f")
m = D("m")
i = B("i")
e = C("e")
l = D("l")

j.s = b
j.y = b
j.v = i
j.z = i
b.r = i
f.s = i
f.x = l
m.w = l
m.v = i
i.r = b
e.s = b
e.x = m
l.w = m
l.v = b
assert m.w.v.r.r.r.txt == "i"