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

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

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

j = A("j")
a = B("a")
c = C("c")
f = B("f")
l = C("l")
e = A("e")

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

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

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

j = A("j")
a = B("a")
c = C("c")
f = B("f")
l = C("l")
e = A("e")

j.o = a
j.w = l
j.y = l
a.q = f
a.r = c
a.w = c
c.s = f
f.q = a
f.r = l
f.w = l
l.s = a
e.o = f
e.w = l
e.y = l
assert l.s.w.s.q.txt == "a"