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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: E = None
        self.s: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: C = None
        self.t: B = None
        self.y: D = None
        self.v: B = None
        self.txt = txt

l = A("l")
a = B("a")
j = C("j")
b = D("b")
i = E("i")

l.v = a
a.o = b
a.v = i
a.s = l
j.u = l
j.o = a
b.t = j
b.o = i
i.s = b
i.y = b
i.q = j
i.t = a
i.v = a
assert a.v.v.s.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: E = None
        self.s: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: C = None
        self.t: B = None
        self.y: D = None
        self.v: B = None
        self.txt = txt

l = A("l")
a = B("a")
j = C("j")
b = D("b")
i = E("i")

l.v = a
a.o = b
a.v = i
a.s = l
j.u = l
j.o = a
b.t = j
b.o = i
i.s = b
i.y = b
i.q = j
i.t = a
i.v = a
assert a.v.v.s.v.s.txt == "l"