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

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: A = None
        self.r: B = None
        self.w: B = None
        self.txt = txt

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

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

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

j.x = b
m.x = h
m.w = h
m.o = h
m.t = j
h.u = j
h.q = j
h.r = m
h.w = m
n.v = m
b.v = j
b.x = j
b.q = m
assert m.o.u.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: A = None
        self.r: B = None
        self.w: B = None
        self.txt = txt

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

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

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

j.x = b
m.x = h
m.w = h
m.o = h
m.t = j
h.u = j
h.q = j
h.r = m
h.w = m
n.v = m
b.v = j
b.x = j
b.q = m
assert m.o.u.x.v.txt == "j"