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

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

a = A("a")
f = B("f")
c = A("c")
l = A("l")
n = B("n")
e = B("e")
h = B("h")
b = B("b")
m = A("m")

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

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

a = A("a")
f = B("f")
c = A("c")
l = A("l")
n = B("n")
e = B("e")
h = B("h")
b = B("b")
m = A("m")

a.s = f
a.v = n
f.q = n
f.r = c
c.s = b
c.v = h
l.s = n
l.v = h
n.q = f
n.r = c
e.q = b
e.r = l
h.q = n
h.r = c
b.q = n
b.r = a
m.s = h
m.v = n
assert c.s.r.v.q.txt == "f"