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

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

j = A("j")
n = B("n")
a = B("a")
i = B("i")
h = B("h")
k = B("k")
d = A("d")

j.q = d
n.r = j
n.z = k
a.r = d
a.z = n
i.r = j
i.z = k
h.r = j
h.z = i
k.r = d
k.z = n
d.q = j
assert a.z.r.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

j = A("j")
n = B("n")
a = B("a")
i = B("i")
h = B("h")
k = B("k")
d = A("d")

j.q = d
n.r = j
n.z = k
a.r = d
a.z = n
i.r = j
i.z = k
h.r = j
h.z = i
k.r = d
k.z = n
d.q = j
assert a.z.r.q.q.q.q.txt == "j"