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

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

f = A("f")
e = B("e")
g = A("g")
c = A("c")
j = B("j")
k = A("k")
m = B("m")
n = A("n")
l = A("l")

f.x = g
e.v = c
e.y = j
g.x = f
c.x = k
j.v = f
j.y = m
k.x = c
m.v = n
m.y = j
n.x = l
l.x = g
assert f.x.x.x.x.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

f = A("f")
e = B("e")
g = A("g")
c = A("c")
j = B("j")
k = A("k")
m = B("m")
n = A("n")
l = A("l")

f.x = g
e.v = c
e.y = j
g.x = f
c.x = k
j.v = f
j.y = m
k.x = c
m.v = n
m.y = j
n.x = l
l.x = g
assert f.x.x.x.x.x.x.x.x.x.txt == "g"