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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: A = None
        self.t: B = None
        self.p: E = None
        self.txt = txt

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

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

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

m = A("m")
b = B("b")
d = C("d")
g = D("g")
h = E("h")
a = A("a")
f = E("f")
k = B("k")
n = D("n")

m.y = a
m.v = a
m.w = d
m.p = g
b.o = d
b.q = m
b.t = k
b.p = f
d.o = f
d.u = a
g.v = n
h.p = n
h.s = n
h.z = a
a.y = m
a.v = m
a.w = d
a.p = g
f.p = g
f.s = g
f.z = m
k.o = d
k.q = m
k.t = b
k.p = f
n.v = g
assert f.z.v.w.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: C = None
        self.p: D = None
        self.v: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: A = None
        self.t: B = None
        self.p: E = None
        self.txt = txt

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

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

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

m = A("m")
b = B("b")
d = C("d")
g = D("g")
h = E("h")
a = A("a")
f = E("f")
k = B("k")
n = D("n")

m.y = a
m.v = a
m.w = d
m.p = g
b.o = d
b.q = m
b.t = k
b.p = f
d.o = f
d.u = a
g.v = n
h.p = n
h.s = n
h.z = a
a.y = m
a.v = m
a.w = d
a.p = g
f.p = g
f.s = g
f.z = m
k.o = d
k.q = m
k.t = b
k.p = f
n.v = g
assert f.z.v.w.u.y.txt == "m"