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

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

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

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

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

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

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

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

b.o = l
b.t = l
b.x = a
j.z = b
j.p = d
j.s = n
e.x = a
n.z = b
n.p = e
n.s = a
d.x = n
l.o = b
l.t = b
l.x = j
a.z = l
a.p = d
a.s = n
assert j.z.x.z.x.txt == "j"