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

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

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

a = A("a")
k = B("k")
l = C("l")
m = C("m")
n = B("n")
j = A("j")
g = B("g")
d = C("d")

a.s = d
a.u = n
a.x = m
k.y = g
k.o = n
l.t = d
m.t = l
n.y = k
n.o = k
j.s = l
j.u = k
j.x = m
g.y = k
g.o = k
d.t = l
assert g.o.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: B = None
        self.x: C = None
        self.txt = txt

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

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

a = A("a")
k = B("k")
l = C("l")
m = C("m")
n = B("n")
j = A("j")
g = B("g")
d = C("d")

a.s = d
a.u = n
a.x = m
k.y = g
k.o = n
l.t = d
m.t = l
n.y = k
n.o = k
j.s = l
j.u = k
j.x = m
g.y = k
g.o = k
d.t = l
assert g.o.o.y.txt == "k"