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

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

e = A("e")
j = B("j")
h = A("h")
n = A("n")
a = A("a")
i = B("i")

e.z = a
e.t = n
j.s = i
j.r = i
h.z = e
h.t = n
n.z = e
n.t = e
a.z = n
a.t = h
i.s = j
i.r = j
assert j.r.r.s.r.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: A = None
        self.txt = txt

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

e = A("e")
j = B("j")
h = A("h")
n = A("n")
a = A("a")
i = B("i")

e.z = a
e.t = n
j.s = i
j.r = i
h.z = e
h.t = n
n.z = e
n.t = e
a.z = n
a.t = h
i.s = j
i.r = j
assert j.r.r.s.r.s.s.txt == "j"