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

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

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

c = A("c")
g = B("g")
d = C("d")
h = B("h")
a = A("a")
n = A("n")
i = A("i")

c.z = d
c.w = d
c.q = h
g.v = h
d.u = h
h.v = g
a.z = d
a.w = d
a.q = g
n.z = d
n.w = d
n.q = g
i.z = d
i.w = d
i.q = g
assert c.z.u.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: C = None
        self.q: B = None
        self.txt = txt

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

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

c = A("c")
g = B("g")
d = C("d")
h = B("h")
a = A("a")
n = A("n")
i = A("i")

c.z = d
c.w = d
c.q = h
g.v = h
d.u = h
h.v = g
a.z = d
a.w = d
a.q = g
n.z = d
n.w = d
n.q = g
i.z = d
i.w = d
i.q = g
assert c.z.u.v.v.v.txt == "g"