class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.w: D = None
        self.x: B = None
        self.z: C = None
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: E = None
        self.y: E = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: E = None
        self.y: E = None
        self.p: E = None
        self.txt = txt

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

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

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

h.t = n
h.w = n
h.x = d
h.z = c
h.q = j
d.s = n
d.r = n
d.y = h
d.w = h
c.w = j
c.s = j
c.y = j
c.p = j
n.t = c
j.v = c
j.s = m
m.t = n
m.w = n
m.x = d
m.z = c
m.q = j
assert j.s.x.y.q.txt == "j"