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

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

e = A("e")
k = B("k")
c = A("c")
f = B("f")
j = A("j")
g = B("g")
d = B("d")
l = B("l")
a = B("a")

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

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

e = A("e")
k = B("k")
c = A("c")
f = B("f")
j = A("j")
g = B("g")
d = B("d")
l = B("l")
a = B("a")

e.w = k
e.t = a
k.x = j
c.w = g
c.t = k
f.x = e
j.w = f
j.t = l
g.x = e
d.x = c
l.x = e
a.x = j
assert l.x.t.x.t.x.t.x.txt == "j"