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

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

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

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

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

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

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

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

b.p = a
i.q = k
i.x = b
n.s = l
n.p = i
n.o = c
e.q = b
e.x = b
k.p = n
c.q = b
c.x = k
a.s = n
a.p = c
a.o = c
l.s = a
l.p = e
l.o = e
assert e.x.p.s.o.x.txt == "k"