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

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

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

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

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

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

j.x = m
j.p = f
m.w = j
m.s = j
m.z = j
m.u = b
m.r = f
l.p = h
l.r = m
l.s = b
h.u = b
h.w = b
h.p = f
h.s = m
f.p = h
f.v = h
b.u = h
b.w = h
b.p = f
b.s = m
assert b.p.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

j.x = m
j.p = f
m.w = j
m.s = j
m.z = j
m.u = b
m.r = f
l.p = h
l.r = m
l.s = b
h.u = b
h.w = b
h.p = f
h.s = m
f.p = h
f.v = h
b.u = h
b.w = h
b.p = f
b.s = m
assert b.p.v.u.txt == "b"