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

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

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

c = A("c")
f = B("f")
d = C("d")
j = A("j")
a = A("a")
l = C("l")
g = A("g")
k = B("k")

c.s = d
c.y = a
c.w = a
f.o = c
d.q = f
d.y = f
j.s = d
j.y = g
j.w = c
a.s = d
a.y = g
a.w = j
l.q = f
l.y = f
g.s = d
g.y = j
g.w = c
k.o = g
assert a.y.s.y.o.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: A = None
        self.w: A = None
        self.txt = txt

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

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

c = A("c")
f = B("f")
d = C("d")
j = A("j")
a = A("a")
l = C("l")
g = A("g")
k = B("k")

c.s = d
c.y = a
c.w = a
f.o = c
d.q = f
d.y = f
j.s = d
j.y = g
j.w = c
a.s = d
a.y = g
a.w = j
l.q = f
l.y = f
g.s = d
g.y = j
g.w = c
k.o = g
assert a.y.s.y.o.y.y.y.txt == "j"