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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: A = None
        self.txt = txt

i = A("i")
n = B("n")
e = A("e")
d = B("d")
l = B("l")
h = A("h")

i.s = d
n.o = h
n.x = h
e.s = d
d.o = h
d.x = e
l.o = h
l.x = e
h.s = d
assert i.s.x.s.o.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: A = None
        self.txt = txt

i = A("i")
n = B("n")
e = A("e")
d = B("d")
l = B("l")
h = A("h")

i.s = d
n.o = h
n.x = h
e.s = d
d.o = h
d.x = e
l.o = h
l.x = e
h.s = d
assert i.s.x.s.o.s.o.txt == "h"