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

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

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

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

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

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

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

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

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

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

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

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

k.q = h
k.v = a
k.y = a
d.v = a
d.z = h
d.s = h
d.x = h
d.u = j
b.x = h
j.t = g
j.x = b
j.u = n
j.r = h
h.p = a
h.s = b
n.v = k
n.z = h
n.s = h
n.x = h
n.u = j
a.q = h
a.v = k
a.y = k
g.v = a
g.z = h
g.s = h
g.x = h
g.u = j
assert h.s.x.p.txt == "a"