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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.s: D = None
        self.q: E = None
        self.txt = txt

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

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

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

m = A("m")
h = B("h")
e = C("e")
a = D("a")
f = E("f")
g = C("g")

m.x = h
m.v = g
m.z = a
h.u = f
h.q = f
h.s = a
e.y = f
e.r = a
a.p = e
a.q = e
a.z = f
a.v = g
a.o = m
f.z = m
f.w = m
f.p = m
f.s = m
f.v = e
g.y = f
g.r = a
assert a.v.y.v.r.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: C = None
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.s: D = None
        self.q: E = None
        self.txt = txt

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

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

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

m = A("m")
h = B("h")
e = C("e")
a = D("a")
f = E("f")
g = C("g")

m.x = h
m.v = g
m.z = a
h.u = f
h.q = f
h.s = a
e.y = f
e.r = a
a.p = e
a.q = e
a.z = f
a.v = g
a.o = m
f.z = m
f.w = m
f.p = m
f.s = m
f.v = e
g.y = f
g.r = a
assert a.v.y.v.r.v.y.txt == "f"