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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: B = None
        self.z: C = None
        self.t: A = None
        self.u: C = None
        self.txt = txt

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

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

h = A("h")
m = B("m")
b = C("b")
g = D("g")
f = E("f")
j = B("j")
n = C("n")

h.y = g
m.t = n
m.o = h
m.u = f
b.r = g
b.o = m
b.z = n
b.u = n
b.t = h
g.p = j
g.r = m
g.x = h
g.u = f
f.x = g
j.t = n
j.o = h
j.u = f
n.r = g
n.o = m
n.z = b
n.u = b
n.t = h
assert g.p.o.y.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: B = None
        self.z: C = None
        self.t: A = None
        self.u: C = None
        self.txt = txt

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

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

h = A("h")
m = B("m")
b = C("b")
g = D("g")
f = E("f")
j = B("j")
n = C("n")

h.y = g
m.t = n
m.o = h
m.u = f
b.r = g
b.o = m
b.z = n
b.u = n
b.t = h
g.p = j
g.r = m
g.x = h
g.u = f
f.x = g
j.t = n
j.o = h
j.u = f
n.r = g
n.o = m
n.z = b
n.u = b
n.t = h
assert g.p.o.y.p.o.txt == "h"