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

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

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

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

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

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

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

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

i.p = d
i.x = b
b.s = e
l.x = i
l.z = a
n.x = e
n.z = i
k.s = e
e.p = n
e.x = k
d.x = i
d.z = a
a.p = n
a.x = k
assert b.s.x.s.p.z.txt == "i"