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

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

l = A("l")
a = B("a")
c = B("c")
e = B("e")
i = A("i")
h = A("h")
d = B("d")
j = A("j")
f = A("f")

l.w = a
l.q = j
a.t = f
a.y = c
c.t = l
c.y = e
e.t = i
e.y = a
i.w = c
i.q = h
h.w = c
h.q = f
d.t = h
d.y = c
j.w = c
j.q = h
f.w = a
f.q = j
assert i.q.w.y.t.q.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.q: A = None
        self.txt = txt

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

l = A("l")
a = B("a")
c = B("c")
e = B("e")
i = A("i")
h = A("h")
d = B("d")
j = A("j")
f = A("f")

l.w = a
l.q = j
a.t = f
a.y = c
c.t = l
c.y = e
e.t = i
e.y = a
i.w = c
i.q = h
h.w = c
h.q = f
d.t = h
d.y = c
j.w = c
j.q = h
f.w = a
f.q = j
assert i.q.w.y.t.q.w.t.txt == "l"