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

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

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

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

a = A("a")
k = B("k")
g = C("g")
n = D("n")
f = C("f")
b = C("b")
d = D("d")
c = B("c")

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

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

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

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

a = A("a")
k = B("k")
g = C("g")
n = D("n")
f = C("f")
b = C("b")
d = D("d")
c = B("c")

a.t = k
a.y = k
a.v = b
k.v = c
k.q = b
g.z = a
g.x = a
g.r = c
g.v = k
n.q = f
n.z = d
n.y = b
n.o = a
f.z = a
f.x = a
f.r = c
f.v = k
b.z = a
b.x = a
b.r = k
b.v = c
d.q = g
d.z = n
d.y = b
d.o = a
c.v = k
c.q = b
assert c.q.v.v.v.txt == "c"