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

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

c = A("c")
f = B("f")
a = B("a")
g = A("g")
d = A("d")
b = A("b")
n = A("n")
h = A("h")
l = A("l")

c.v = a
f.y = a
a.y = f
g.v = f
d.v = a
b.v = f
n.v = f
h.v = a
l.v = f
assert c.v.y.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

c = A("c")
f = B("f")
a = B("a")
g = A("g")
d = A("d")
b = A("b")
n = A("n")
h = A("h")
l = A("l")

c.v = a
f.y = a
a.y = f
g.v = f
d.v = a
b.v = f
n.v = f
h.v = a
l.v = f
assert c.v.y.y.y.y.y.y.y.txt == "f"