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

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

b = A("b")
f = B("f")
i = A("i")
g = A("g")
c = B("c")

b.v = f
f.u = c
f.t = c
i.v = c
g.v = c
c.u = f
c.t = f
assert c.u.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

b = A("b")
f = B("f")
i = A("i")
g = A("g")
c = B("c")

b.v = f
f.u = c
f.t = c
i.v = c
g.v = c
c.u = f
c.t = f
assert c.u.t.u.txt == "f"