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

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

f = A("f")
d = B("d")
i = A("i")
l = A("l")
c = B("c")
k = B("k")

f.s = i
f.v = l
d.t = k
d.s = k
i.s = l
i.v = f
l.s = f
l.v = f
c.t = d
c.s = k
k.t = c
k.s = d
assert d.s.t.t.s.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: A = None
        self.txt = txt

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

f = A("f")
d = B("d")
i = A("i")
l = A("l")
c = B("c")
k = B("k")

f.s = i
f.v = l
d.t = k
d.s = k
i.s = l
i.v = f
l.s = f
l.v = f
c.t = d
c.s = k
k.t = c
k.s = d
assert d.s.t.t.s.t.s.txt == "k"