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

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

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

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

b.s = n
i.z = g
n.o = a
n.z = g
j.s = g
a.z = g
l.s = n
e.z = n
g.o = i
g.z = n
assert i.z.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

b.s = n
i.z = g
n.o = a
n.z = g
j.s = g
a.z = g
l.s = n
e.z = n
g.o = i
g.z = n
assert i.z.o.z.txt == "g"