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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.u: C = None
        self.q: C = None
        self.r: C = None
        self.y: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: A = None
        self.r: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: A = None
        self.p: D = None
        self.u: C = None
        self.txt = txt

l = A("l")
m = B("m")
c = C("c")
k = D("k")
n = E("n")
b = A("b")

l.v = n
m.p = n
m.u = c
m.q = c
m.r = c
m.y = l
c.q = k
c.y = l
c.r = n
k.p = l
k.s = l
k.v = c
k.q = m
k.w = n
n.t = k
n.p = k
n.v = l
n.u = c
b.v = n
assert n.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.u: C = None
        self.q: C = None
        self.r: C = None
        self.y: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: A = None
        self.r: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: A = None
        self.p: D = None
        self.u: C = None
        self.txt = txt

l = A("l")
m = B("m")
c = C("c")
k = D("k")
n = E("n")
b = A("b")

l.v = n
m.p = n
m.u = c
m.q = c
m.r = c
m.y = l
c.q = k
c.y = l
c.r = n
k.p = l
k.s = l
k.v = c
k.q = m
k.w = n
n.t = k
n.p = k
n.v = l
n.u = c
b.v = n
assert n.v.v.v.v.v.txt == "l"