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

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

g = A("g")
c = B("c")
e = A("e")

g.y = c
g.t = e
c.v = e
e.y = c
e.t = g
assert e.y.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: A = None
        self.txt = txt

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

g = A("g")
c = B("c")
e = A("e")

g.y = c
g.t = e
c.v = e
e.y = c
e.t = g
assert e.y.v.t.txt == "g"