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

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

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

n = A("n")
g = B("g")
d = C("d")
i = C("i")
e = C("e")
c = A("c")
l = B("l")

n.o = i
n.s = c
g.z = c
g.p = e
g.t = l
d.x = n
i.x = c
e.x = c
c.o = i
c.s = n
l.z = n
l.p = e
l.t = g
assert e.x.o.x.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: A = None
        self.txt = txt

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

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

n = A("n")
g = B("g")
d = C("d")
i = C("i")
e = C("e")
c = A("c")
l = B("l")

n.o = i
n.s = c
g.z = c
g.p = e
g.t = l
d.x = n
i.x = c
e.x = c
c.o = i
c.s = n
l.z = n
l.p = e
l.t = g
assert e.x.o.x.o.x.txt == "c"