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

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

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

e = A("e")
b = B("b")
i = C("i")
l = A("l")
g = B("g")
k = B("k")
f = A("f")
d = C("d")
j = C("j")
c = B("c")

e.q = d
e.t = f
b.q = j
i.w = e
l.q = d
l.t = f
g.q = i
k.q = i
f.q = i
f.t = e
d.w = f
j.w = f
c.q = d
assert j.w.t.q.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: A = None
        self.txt = txt

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

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

e = A("e")
b = B("b")
i = C("i")
l = A("l")
g = B("g")
k = B("k")
f = A("f")
d = C("d")
j = C("j")
c = B("c")

e.q = d
e.t = f
b.q = j
i.w = e
l.q = d
l.t = f
g.q = i
k.q = i
f.q = i
f.t = e
d.w = f
j.w = f
c.q = d
assert j.w.t.q.w.q.txt == "i"