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

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

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

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

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

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

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

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

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

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

e.s = l
e.z = d
k.r = j
k.o = e
k.w = d
k.q = d
l.v = d
d.r = j
d.u = k
d.s = e
j.r = k
j.o = e
j.w = d
j.q = d
assert l.v.u.w.txt == "d"