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

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

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

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

e = A("e")
h = B("h")
b = C("b")
a = D("a")
l = B("l")
m = D("m")
d = D("d")
n = A("n")

e.u = n
e.s = n
e.x = n
e.z = m
h.x = l
h.q = l
h.p = d
b.y = e
b.v = e
b.s = n
b.p = l
a.x = e
l.x = h
l.q = h
l.p = d
m.x = e
d.x = e
n.u = e
n.s = e
n.x = e
n.z = m
assert h.p.x.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: A = None
        self.x: A = None
        self.z: D = None
        self.txt = txt

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

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

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

e = A("e")
h = B("h")
b = C("b")
a = D("a")
l = B("l")
m = D("m")
d = D("d")
n = A("n")

e.u = n
e.s = n
e.x = n
e.z = m
h.x = l
h.q = l
h.p = d
b.y = e
b.v = e
b.s = n
b.p = l
a.x = e
l.x = h
l.q = h
l.p = d
m.x = e
d.x = e
n.u = e
n.s = e
n.x = e
n.z = m
assert h.p.x.z.x.txt == "e"