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

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

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

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

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

m = A("m")
j = B("j")
d = C("d")
g = D("g")
l = E("l")
i = C("i")

m.v = i
j.x = m
d.u = i
d.y = i
d.o = m
d.v = j
d.w = g
g.p = d
g.v = d
g.r = j
l.y = j
l.w = d
l.p = d
l.v = i
l.t = m
i.u = d
i.y = d
i.o = m
i.v = j
i.w = g
assert l.y.x.v.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

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

m = A("m")
j = B("j")
d = C("d")
g = D("g")
l = E("l")
i = C("i")

m.v = i
j.x = m
d.u = i
d.y = i
d.o = m
d.v = j
d.w = g
g.p = d
g.v = d
g.r = j
l.y = j
l.w = d
l.p = d
l.v = i
l.t = m
i.u = d
i.y = d
i.o = m
i.v = j
i.w = g
assert l.y.x.v.v.x.txt == "m"