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

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

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

g = A("g")
l = B("l")
c = C("c")
m = C("m")
n = C("n")
j = B("j")
h = B("h")
b = A("b")
f = A("f")
e = B("e")

g.s = c
g.q = m
g.y = l
l.o = m
c.y = m
m.y = n
n.y = c
j.o = c
h.o = c
b.s = n
b.q = n
b.y = l
f.s = n
f.q = c
f.y = j
e.o = m
assert b.y.o.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: C = None
        self.y: B = None
        self.txt = txt

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

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

g = A("g")
l = B("l")
c = C("c")
m = C("m")
n = C("n")
j = B("j")
h = B("h")
b = A("b")
f = A("f")
e = B("e")

g.s = c
g.q = m
g.y = l
l.o = m
c.y = m
m.y = n
n.y = c
j.o = c
h.o = c
b.s = n
b.q = n
b.y = l
f.s = n
f.q = c
f.y = j
e.o = m
assert b.y.o.y.y.y.y.txt == "n"