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

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

h = A("h")
i = B("i")
l = A("l")
a = B("a")
b = A("b")
c = B("c")

h.u = l
h.s = b
i.y = h
i.r = c
l.u = h
l.s = h
a.y = b
a.r = c
b.u = h
b.s = l
c.y = b
c.r = a
assert i.r.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: A = None
        self.txt = txt

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

h = A("h")
i = B("i")
l = A("l")
a = B("a")
b = A("b")
c = B("c")

h.u = l
h.s = b
i.y = h
i.r = c
l.u = h
l.s = h
a.y = b
a.r = c
b.u = h
b.s = l
c.y = b
c.r = a
assert i.r.y.s.txt == "l"