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

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

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

b = A("b")
e = B("e")
f = C("f")
j = C("j")
i = B("i")
a = A("a")
d = C("d")
n = A("n")

b.q = f
e.o = a
e.t = i
f.w = a
f.y = a
f.q = e
j.w = a
j.y = a
j.q = i
i.o = b
i.t = e
a.q = d
d.w = a
d.y = n
d.q = i
n.q = f
assert b.q.q.t.t.t.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

b = A("b")
e = B("e")
f = C("f")
j = C("j")
i = B("i")
a = A("a")
d = C("d")
n = A("n")

b.q = f
e.o = a
e.t = i
f.w = a
f.y = a
f.q = e
j.w = a
j.y = a
j.q = i
i.o = b
i.t = e
a.q = d
d.w = a
d.y = n
d.q = i
n.q = f
assert b.q.q.t.t.t.o.q.txt == "f"