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

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

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

a = A("a")
e = B("e")
c = C("c")
i = B("i")
d = B("d")
m = C("m")
l = A("l")

a.y = l
e.y = c
e.r = l
e.o = m
c.t = d
c.v = d
c.p = e
i.y = m
i.o = m
i.r = a
d.y = m
d.o = m
d.r = a
m.t = d
m.p = i
m.v = i
l.y = a
assert l.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

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

a = A("a")
e = B("e")
c = C("c")
i = B("i")
d = B("d")
m = C("m")
l = A("l")

a.y = l
e.y = c
e.r = l
e.o = m
c.t = d
c.v = d
c.p = e
i.y = m
i.o = m
i.r = a
d.y = m
d.o = m
d.r = a
m.t = d
m.p = i
m.v = i
l.y = a
assert l.y.y.y.y.y.txt == "a"