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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: E = None
        self.z: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

g = A("g")
f = B("f")
j = C("j")
l = D("l")
h = E("h")
a = A("a")

g.v = j
f.o = l
f.p = h
f.z = h
j.w = l
j.x = h
l.z = h
h.v = l
h.y = f
h.u = g
a.v = j
assert a.v.x.u.v.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: E = None
        self.z: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

g = A("g")
f = B("f")
j = C("j")
l = D("l")
h = E("h")
a = A("a")

g.v = j
f.o = l
f.p = h
f.z = h
j.w = l
j.x = h
l.z = h
h.v = l
h.y = f
h.u = g
a.v = j
assert a.v.x.u.v.w.z.txt == "h"