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

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

b = A("b")
e = B("e")
j = A("j")
c = A("c")
g = B("g")
k = B("k")
f = B("f")

b.q = f
b.t = k
e.w = b
e.y = g
j.q = f
j.t = g
c.q = e
c.t = e
g.w = c
g.y = k
k.w = c
k.y = e
f.w = c
f.y = g
assert k.y.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: B = None
        self.txt = txt

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

b = A("b")
e = B("e")
j = A("j")
c = A("c")
g = B("g")
k = B("k")
f = B("f")

b.q = f
b.t = k
e.w = b
e.y = g
j.q = f
j.t = g
c.q = e
c.t = e
g.w = c
g.y = k
k.w = c
k.y = e
f.w = c
f.y = g
assert k.y.w.t.txt == "k"