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

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

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

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

g.o = n
g.p = j
e.p = g
e.v = n
k.z = j
k.p = e
k.o = i
c.p = g
c.v = k
j.z = k
j.p = e
j.o = e
n.z = j
n.p = i
n.o = c
i.p = g
i.v = j
assert n.o.p.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.p: C = None
        self.txt = txt

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

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

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

g.o = n
g.p = j
e.p = g
e.v = n
k.z = j
k.p = e
k.o = i
c.p = g
c.v = k
j.z = k
j.p = e
j.o = e
n.z = j
n.p = i
n.o = c
i.p = g
i.v = j
assert n.o.p.p.z.txt == "k"