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

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

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

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

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

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

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

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

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

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

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