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

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

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: A = None
        self.r: A = None
        self.txt = txt

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

d.v = a
a.z = c
c.u = b
c.p = d
c.r = d
n.z = c
i.u = g
i.p = d
i.r = d
b.u = g
b.p = d
b.r = d
g.u = i
g.p = d
g.r = d
f.u = c
f.p = d
f.r = d
assert c.u.u.p.v.z.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: A = None
        self.r: A = None
        self.txt = txt

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

d.v = a
a.z = c
c.u = b
c.p = d
c.r = d
n.z = c
i.u = g
i.p = d
i.r = d
b.u = g
b.p = d
b.r = d
g.u = i
g.p = d
g.r = d
f.u = c
f.p = d
f.r = d
assert c.u.u.p.v.z.r.v.txt == "a"