class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: C = None
        self.r: B = None
        self.x: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.s: A = None
        self.r: E = None
        self.u: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: B = None
        self.t: A = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.s: A = None
        self.r: E = None
        self.u: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: B = None
        self.t: A = None
        self.txt = txt

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

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