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

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

h = A("h")
n = B("n")
i = B("i")

h.v = n
h.o = i
n.t = h
n.s = i
i.t = h
i.s = n
assert h.v.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.o: B = None
        self.txt = txt

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

h = A("h")
n = B("n")
i = B("i")

h.v = n
h.o = i
n.t = h
n.s = i
i.t = h
i.s = n
assert h.v.t.o.txt == "i"