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

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

a = A("a")
l = B("l")
j = B("j")
n = A("n")
d = A("d")
k = B("k")

a.w = d
a.t = n
l.z = j
l.y = n
j.z = l
j.y = n
n.w = a
n.t = d
d.w = n
d.t = a
k.z = l
k.y = n
assert k.y.w.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.t: A = None
        self.txt = txt

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

a = A("a")
l = B("l")
j = B("j")
n = A("n")
d = A("d")
k = B("k")

a.w = d
a.t = n
l.z = j
l.y = n
j.z = l
j.y = n
n.w = a
n.t = d
d.w = n
d.t = a
k.z = l
k.y = n
assert k.y.w.w.t.txt == "a"