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

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

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

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

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

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

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

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

l.r = d
l.t = k
l.p = c
c.s = e
d.q = e
d.w = m
e.q = d
e.w = b
j.r = d
j.t = i
j.p = k
f.r = b
f.t = k
f.p = c
i.s = d
k.s = b
m.q = e
m.w = e
b.q = e
b.w = m
assert b.w.w.w.w.q.w.q.w.txt == "b"