class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: C = None
        self.u: E = 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.v: A = None
        self.p: E = None
        self.t: B = None
        self.txt = txt

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

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

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

m.y = a
m.o = a
m.u = f
d.x = m
a.v = m
a.p = f
a.t = d
n.w = d
n.p = d
n.y = f
b.p = m
b.z = n
f.p = m
f.z = n
assert b.p.o.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: C = None
        self.u: E = 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.v: A = None
        self.p: E = None
        self.t: B = None
        self.txt = txt

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

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

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

m.y = a
m.o = a
m.u = f
d.x = m
a.v = m
a.p = f
a.t = d
n.w = d
n.p = d
n.y = f
b.p = m
b.z = n
f.p = m
f.z = n
assert b.p.o.v.o.txt == "a"