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

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

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

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

b = A("b")
a = B("a")
j = C("j")
e = D("e")
g = C("g")
l = D("l")
i = C("i")

b.w = l
b.y = a
b.v = a
b.s = g
a.q = j
j.v = a
e.y = i
g.v = a
l.y = g
i.v = a
assert b.y.q.v.q.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: B = None
        self.v: B = None
        self.s: C = None
        self.txt = txt

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

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

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

b = A("b")
a = B("a")
j = C("j")
e = D("e")
g = C("g")
l = D("l")
i = C("i")

b.w = l
b.y = a
b.v = a
b.s = g
a.q = j
j.v = a
e.y = i
g.v = a
l.y = g
i.v = a
assert b.y.q.v.q.v.q.txt == "j"