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

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

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

b = A("b")
k = B("k")
n = C("n")
i = B("i")
d = A("d")
e = C("e")
h = B("h")
c = A("c")
a = C("a")

b.p = n
b.r = a
k.o = e
k.s = i
n.s = e
n.x = h
i.o = e
i.s = h
d.p = a
d.r = e
e.s = n
e.x = i
h.o = e
h.s = k
c.p = e
c.r = a
a.s = n
a.x = i
assert c.r.x.s.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: C = None
        self.txt = txt

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

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

b = A("b")
k = B("k")
n = C("n")
i = B("i")
d = A("d")
e = C("e")
h = B("h")
c = A("c")
a = C("a")

b.p = n
b.r = a
k.o = e
k.s = i
n.s = e
n.x = h
i.o = e
i.s = h
d.p = a
d.r = e
e.s = n
e.x = i
h.o = e
h.s = k
c.p = e
c.r = a
a.s = n
a.x = i
assert c.r.x.s.o.s.txt == "n"