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

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

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

e = A("e")
m = B("m")
a = C("a")
f = A("f")
b = C("b")
c = A("c")
d = B("d")
i = C("i")
g = C("g")
n = A("n")

e.v = b
e.y = n
m.t = f
a.u = c
f.v = i
f.y = c
b.u = f
c.v = g
c.y = e
d.t = n
i.u = n
g.u = e
n.v = i
n.y = e
assert f.v.u.y.y.v.u.v.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: A = None
        self.txt = txt

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

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

e = A("e")
m = B("m")
a = C("a")
f = A("f")
b = C("b")
c = A("c")
d = B("d")
i = C("i")
g = C("g")
n = A("n")

e.v = b
e.y = n
m.t = f
a.u = c
f.v = i
f.y = c
b.u = f
c.v = g
c.y = e
d.t = n
i.u = n
g.u = e
n.v = i
n.y = e
assert f.v.u.y.y.v.u.v.u.v.txt == "i"