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

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

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

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

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

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

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

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

j.p = n
j.z = c
j.r = g
k.o = b
k.q = i
k.t = j
c.w = n
b.o = k
b.q = i
b.t = j
f.p = n
f.z = n
f.r = d
g.p = c
g.z = n
g.r = f
a.o = k
a.q = i
a.t = j
n.w = c
i.o = a
i.q = a
i.t = d
d.p = c
d.z = n
d.r = j
assert i.t.p.w.w.w.w.w.w.txt == "c"