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

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

i = A("i")
c = B("c")
b = A("b")
l = A("l")
j = A("j")
n = B("n")
g = B("g")
f = A("f")
a = A("a")
k = B("k")

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

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

i = A("i")
c = B("c")
b = A("b")
l = A("l")
j = A("j")
n = B("n")
g = B("g")
f = A("f")
a = A("a")
k = B("k")

i.y = n
c.v = g
b.y = g
l.y = k
j.y = n
n.v = k
g.v = c
f.y = c
a.y = n
k.v = c
assert f.y.v.v.v.txt == "g"