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

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

e = A("e")
l = B("l")
h = A("h")
n = B("n")
f = A("f")

e.v = l
e.q = n
l.u = h
l.s = f
h.v = n
h.q = l
n.u = f
n.s = e
f.v = n
f.q = n
assert h.v.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: B = None
        self.txt = txt

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

e = A("e")
l = B("l")
h = A("h")
n = B("n")
f = A("f")

e.v = l
e.q = n
l.u = h
l.s = f
h.v = n
h.q = l
n.u = f
n.s = e
f.v = n
f.q = n
assert h.v.s.q.txt == "n"