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

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

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

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

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

h = A("h")
k = B("k")
j = C("j")
b = D("b")
d = E("d")

h.z = d
k.r = j
j.t = d
j.p = k
j.q = k
j.o = b
b.v = j
b.x = j
b.w = d
b.t = k
d.y = k
d.v = k
d.p = k
d.r = h
assert j.o.w.r.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

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

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

h = A("h")
k = B("k")
j = C("j")
b = D("b")
d = E("d")

h.z = d
k.r = j
j.t = d
j.p = k
j.q = k
j.o = b
b.v = j
b.x = j
b.w = d
b.t = k
d.y = k
d.v = k
d.p = k
d.r = h
assert j.o.w.r.z.r.txt == "h"