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

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

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

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

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

j.s = b
j.z = b
j.w = l
j.v = l
l.o = j
e.p = b
e.q = b
b.p = e
b.z = j
b.s = l
g.p = b
g.q = b
assert e.q.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.w: B = None
        self.z: D = None
        self.v: B = None
        self.txt = txt

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

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

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

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

j.s = b
j.z = b
j.w = l
j.v = l
l.o = j
e.p = b
e.q = b
b.p = e
b.z = j
b.s = l
g.p = b
g.q = b
assert e.q.z.z.z.txt == "j"