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

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

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

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

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

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

n.v = a
n.y = k
f.z = g
l.v = c
l.y = m
c.z = k
i.z = k
k.v = f
k.y = g
g.v = e
g.y = l
m.v = e
m.y = g
a.z = l
e.z = m
assert i.z.y.y.y.y.y.txt == "l"