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

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

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

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

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

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

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

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

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

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

k.v = f
k.z = a
k.o = g
k.y = d
i.q = c
i.s = a
f.v = k
f.w = a
m.v = k
c.v = k
c.w = a
d.v = k
a.q = c
a.s = i
e.v = k
e.w = i
g.v = k
g.w = a
assert k.z.q.v.y.txt == "d"