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

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

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

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

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

k = A("k")
b = B("b")
n = C("n")
i = D("i")
h = E("h")

k.t = h
k.r = h
k.w = h
k.z = i
k.u = n
b.p = h
b.v = i
n.r = b
n.w = b
n.s = h
i.u = b
h.u = b
h.r = b
h.p = b
h.v = k
assert h.r.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.r: E = None
        self.z: D = None
        self.w: E = None
        self.u: C = None
        self.txt = txt

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

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

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

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

k = A("k")
b = B("b")
n = C("n")
i = D("i")
h = E("h")

k.t = h
k.r = h
k.w = h
k.z = i
k.u = n
b.p = h
b.v = i
n.r = b
n.w = b
n.s = h
i.u = b
h.u = b
h.r = b
h.p = b
h.v = k
assert h.r.v.u.txt == "b"