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

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

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

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

l = A("l")
j = B("j")
g = C("g")
k = D("k")
m = B("m")
d = C("d")

l.q = k
l.v = k
l.y = g
l.r = j
j.w = m
j.u = m
j.z = g
j.y = g
g.w = l
g.z = d
k.o = d
k.x = j
k.y = g
k.v = g
m.w = j
m.u = j
m.z = d
m.y = g
d.w = l
d.z = g
assert l.q.x.y.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: C = None
        self.v: D = None
        self.r: B = None
        self.txt = txt

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

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

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

l = A("l")
j = B("j")
g = C("g")
k = D("k")
m = B("m")
d = C("d")

l.q = k
l.v = k
l.y = g
l.r = j
j.w = m
j.u = m
j.z = g
j.y = g
g.w = l
g.z = d
k.o = d
k.x = j
k.y = g
k.v = g
m.w = j
m.u = j
m.z = d
m.y = g
d.w = l
d.z = g
assert l.q.x.y.z.w.txt == "l"