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

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

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

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

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

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

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

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

e.p = g
e.x = j
e.r = a
k.r = n
k.s = e
k.z = g
j.o = g
j.x = k
g.p = f
g.x = c
g.r = a
l.o = f
l.x = n
i.o = e
i.x = n
a.r = n
a.s = e
a.z = e
n.r = a
n.s = f
n.z = f
f.p = e
f.x = i
f.r = a
c.o = e
c.x = a
assert e.p.r.r.z.r.s.x.o.p.x.txt == "i"