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

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

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

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

i = A("i")
g = B("g")
h = C("h")
k = D("k")
l = B("l")
d = D("d")

i.r = l
i.s = h
i.y = d
g.v = k
h.y = g
h.q = k
k.w = i
k.v = i
k.z = g
l.v = k
d.w = i
d.v = i
d.z = l
assert l.v.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: C = None
        self.y: D = None
        self.txt = txt

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

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

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

i = A("i")
g = B("g")
h = C("h")
k = D("k")
l = B("l")
d = D("d")

i.r = l
i.s = h
i.y = d
g.v = k
h.y = g
h.q = k
k.w = i
k.v = i
k.z = g
l.v = k
d.w = i
d.v = i
d.z = l
assert l.v.w.s.txt == "h"