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

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

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

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

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

f.y = k
f.t = l
k.w = j
l.v = m
l.x = i
l.w = k
l.q = k
j.t = i
j.w = l
i.t = j
i.w = m
m.v = l
m.x = j
m.w = k
m.q = k
assert m.x.t.w.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: C = None
        self.txt = txt

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

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

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

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

f.y = k
f.t = l
k.w = j
l.v = m
l.x = i
l.w = k
l.q = k
j.t = i
j.w = l
i.t = j
i.w = m
m.v = l
m.x = j
m.w = k
m.q = k
assert m.x.t.w.v.v.txt == "m"