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

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

b = A("b")
j = B("j")
f = B("f")
c = B("c")
l = A("l")
a = B("a")
k = A("k")
n = A("n")

b.t = l
b.w = n
j.w = k
f.w = n
c.w = k
l.t = b
l.w = n
a.w = k
k.t = l
k.w = n
n.t = b
n.w = l
assert c.w.t.t.t.t.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.w: A = None
        self.txt = txt

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

b = A("b")
j = B("j")
f = B("f")
c = B("c")
l = A("l")
a = B("a")
k = A("k")
n = A("n")

b.t = l
b.w = n
j.w = k
f.w = n
c.w = k
l.t = b
l.w = n
a.w = k
k.t = l
k.w = n
n.t = b
n.w = l
assert c.w.t.t.t.t.w.w.txt == "l"