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

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

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

g = A("g")
k = B("k")
m = C("m")
i = A("i")
h = B("h")
d = A("d")
e = B("e")
j = C("j")
l = C("l")

g.y = l
g.x = h
g.o = h
k.q = i
m.u = l
i.y = l
i.x = k
i.o = e
h.q = d
d.y = m
d.x = e
d.o = k
e.q = d
j.u = m
l.u = m
assert j.u.u.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: B = None
        self.o: B = None
        self.txt = txt

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

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

g = A("g")
k = B("k")
m = C("m")
i = A("i")
h = B("h")
d = A("d")
e = B("e")
j = C("j")
l = C("l")

g.y = l
g.x = h
g.o = h
k.q = i
m.u = l
i.y = l
i.x = k
i.o = e
h.q = d
d.y = m
d.x = e
d.o = k
e.q = d
j.u = m
l.u = m
assert j.u.u.u.u.u.u.u.u.txt == "l"