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

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

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

l = A("l")
b = B("b")
k = C("k")
n = B("n")
c = B("c")
i = B("i")
m = A("m")
h = A("h")
j = B("j")

l.r = k
b.t = k
b.o = c
k.s = h
k.q = l
k.w = l
n.t = k
n.o = i
c.t = k
c.o = j
i.t = k
i.o = c
m.r = k
h.r = k
j.t = k
j.o = c
assert i.t.q.r.w.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

l = A("l")
b = B("b")
k = C("k")
n = B("n")
c = B("c")
i = B("i")
m = A("m")
h = A("h")
j = B("j")

l.r = k
b.t = k
b.o = c
k.s = h
k.q = l
k.w = l
n.t = k
n.o = i
c.t = k
c.o = j
i.t = k
i.o = c
m.r = k
h.r = k
j.t = k
j.o = c
assert i.t.q.r.w.r.s.txt == "h"