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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: A = None
        self.txt = txt

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

n.y = j
n.v = m
n.r = d
b.u = d
b.w = j
g.s = b
g.x = b
g.u = m
g.w = f
g.t = n
d.r = m
d.p = h
d.t = g
h.s = f
h.y = n
m.s = b
m.w = b
m.x = b
m.u = g
m.t = n
f.u = d
f.w = j
j.s = f
j.y = n
assert j.s.w.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: C = None
        self.r: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: A = None
        self.txt = txt

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

n.y = j
n.v = m
n.r = d
b.u = d
b.w = j
g.s = b
g.x = b
g.u = m
g.w = f
g.t = n
d.r = m
d.p = h
d.t = g
h.s = f
h.y = n
m.s = b
m.w = b
m.x = b
m.u = g
m.t = n
f.u = d
f.w = j
j.s = f
j.y = n
assert j.s.w.y.v.txt == "m"