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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: B = None
        self.u: C = None
        self.txt = txt

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

i.z = n
i.p = n
i.w = h
e.s = n
e.u = i
e.r = d
h.x = n
h.y = n
h.s = j
h.z = d
d.x = i
n.x = j
n.z = j
n.u = h
j.s = n
j.u = i
j.r = d
assert d.x.w.x.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.p: E = None
        self.w: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: B = None
        self.u: C = None
        self.txt = txt

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

i.z = n
i.p = n
i.w = h
e.s = n
e.u = i
e.r = d
h.x = n
h.y = n
h.s = j
h.z = d
d.x = i
n.x = j
n.z = j
n.u = h
j.s = n
j.u = i
j.r = d
assert d.x.w.x.z.u.txt == "i"