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

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

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

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

f.z = e
a.u = k
a.z = g
a.o = j
i.p = e
i.w = a
i.r = d
k.z = c
g.z = c
n.u = f
n.z = f
n.o = j
d.z = c
e.p = c
e.w = j
e.r = f
j.u = g
j.z = k
j.o = a
c.p = i
c.w = n
c.r = k
assert i.p.r.z.w.z.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

f.z = e
a.u = k
a.z = g
a.o = j
i.p = e
i.w = a
i.r = d
k.z = c
g.z = c
n.u = f
n.z = f
n.o = j
d.z = c
e.p = c
e.w = j
e.r = f
j.u = g
j.z = k
j.o = a
c.p = i
c.w = n
c.r = k
assert i.p.r.z.w.z.z.p.txt == "i"