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

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

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

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

k = A("k")
d = B("d")
i = C("i")
g = D("g")
a = B("a")
c = D("c")

k.o = d
k.t = g
k.v = i
d.z = k
d.y = k
d.r = a
i.v = k
i.t = k
i.r = g
g.q = d
a.z = k
a.y = k
a.r = d
c.q = a
assert g.q.y.o.y.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: D = None
        self.v: C = None
        self.txt = txt

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

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

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

k = A("k")
d = B("d")
i = C("i")
g = D("g")
a = B("a")
c = D("c")

k.o = d
k.t = g
k.v = i
d.z = k
d.y = k
d.r = a
i.v = k
i.t = k
i.r = g
g.q = d
a.z = k
a.y = k
a.r = d
c.q = a
assert g.q.y.o.y.o.y.txt == "k"