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

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: E = None
        self.txt = txt

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

d = A("d")
h = B("h")
g = C("g")
j = D("j")
e = E("e")

d.q = e
d.x = e
h.o = j
h.v = g
g.r = e
g.y = e
g.x = h
g.s = j
g.v = j
j.q = g
j.z = e
e.p = j
e.u = d
assert j.z.u.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.x: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: E = None
        self.txt = txt

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

d = A("d")
h = B("h")
g = C("g")
j = D("j")
e = E("e")

d.q = e
d.x = e
h.o = j
h.v = g
g.r = e
g.y = e
g.x = h
g.s = j
g.v = j
j.q = g
j.z = e
e.p = j
e.u = d
assert j.z.u.q.p.txt == "j"