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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: B = None
        self.w: A = None
        self.z: B = 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.q: B = None
        self.txt = txt

e = A("e")
a = B("a")
k = C("k")
g = D("g")
l = B("l")

e.t = k
e.y = k
a.o = g
a.q = l
a.z = l
a.w = e
k.v = g
g.q = a
l.o = g
l.q = a
l.z = a
l.w = e
assert e.y.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: B = None
        self.w: A = None
        self.z: B = 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.q: B = None
        self.txt = txt

e = A("e")
a = B("a")
k = C("k")
g = D("g")
l = B("l")

e.t = k
e.y = k
a.o = g
a.q = l
a.z = l
a.w = e
k.v = g
g.q = a
l.o = g
l.q = a
l.z = a
l.w = e
assert e.y.v.q.txt == "a"