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

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

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

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

f = A("f")
l = B("l")
b = C("b")
k = D("k")
m = A("m")
d = A("d")
n = A("n")
g = A("g")
c = D("c")

f.w = k
l.q = c
l.s = b
b.z = l
b.t = l
k.z = c
k.r = b
k.s = b
k.v = b
m.w = k
d.w = k
n.w = c
g.w = k
c.z = k
c.r = b
c.s = b
c.v = b
assert g.w.r.z.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

f = A("f")
l = B("l")
b = C("b")
k = D("k")
m = A("m")
d = A("d")
n = A("n")
g = A("g")
c = D("c")

f.w = k
l.q = c
l.s = b
b.z = l
b.t = l
k.z = c
k.r = b
k.s = b
k.v = b
m.w = k
d.w = k
n.w = c
g.w = k
c.z = k
c.r = b
c.s = b
c.v = b
assert g.w.r.z.s.t.txt == "l"