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

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

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

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

e = A("e")
c = B("c")
m = C("m")
k = D("k")

e.v = k
e.w = k
c.y = m
c.q = m
c.v = m
c.o = k
m.y = c
m.t = c
m.o = k
m.w = e
k.z = c
assert m.w.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: D = None
        self.txt = txt

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

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

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

e = A("e")
c = B("c")
m = C("m")
k = D("k")

e.v = k
e.w = k
c.y = m
c.q = m
c.v = m
c.o = k
m.y = c
m.t = c
m.o = k
m.w = e
k.z = c
assert m.w.w.z.txt == "c"