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

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

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

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

i.z = j
f.y = g
f.v = a
f.p = i
g.t = a
g.p = f
g.z = i
c.t = g
c.p = f
c.z = i
n.t = c
n.p = j
n.z = i
a.t = g
a.p = j
a.z = i
j.y = a
j.v = g
j.p = i
assert g.p.p.z.p.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

i.z = j
f.y = g
f.v = a
f.p = i
g.t = a
g.p = f
g.z = i
c.t = g
c.p = f
c.z = i
n.t = c
n.p = j
n.z = i
a.t = g
a.p = j
a.z = i
j.y = a
j.v = g
j.p = i
assert g.p.p.z.p.z.v.txt == "g"