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

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

c = A("c")
j = B("j")
n = B("n")
f = A("f")
g = A("g")
l = B("l")
a = A("a")
i = A("i")
d = B("d")

c.v = d
c.t = l
j.w = d
n.w = l
f.v = d
f.t = n
g.v = n
g.t = l
l.w = n
a.v = j
a.t = j
i.v = l
i.t = d
d.w = n
assert f.t.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: B = None
        self.txt = txt

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

c = A("c")
j = B("j")
n = B("n")
f = A("f")
g = A("g")
l = B("l")
a = A("a")
i = A("i")
d = B("d")

c.v = d
c.t = l
j.w = d
n.w = l
f.v = d
f.t = n
g.v = n
g.t = l
l.w = n
a.v = j
a.t = j
i.v = l
i.t = d
d.w = n
assert f.t.w.w.w.txt == "l"