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

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

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

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

g = A("g")
n = B("n")
e = C("e")
h = D("h")
l = C("l")
i = B("i")
d = B("d")
k = D("k")
a = A("a")

g.q = a
g.u = a
g.s = e
n.u = a
n.x = a
n.t = h
e.r = l
e.p = l
e.x = k
h.p = a
h.v = e
l.r = e
l.p = e
l.x = h
i.u = g
i.x = g
i.t = h
d.u = g
d.t = k
d.x = a
k.p = a
k.v = l
a.q = g
a.u = g
a.s = e
assert a.q.s.x.v.p.p.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.u: A = None
        self.s: C = None
        self.txt = txt

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

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

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

g = A("g")
n = B("n")
e = C("e")
h = D("h")
l = C("l")
i = B("i")
d = B("d")
k = D("k")
a = A("a")

g.q = a
g.u = a
g.s = e
n.u = a
n.x = a
n.t = h
e.r = l
e.p = l
e.x = k
h.p = a
h.v = e
l.r = e
l.p = e
l.x = h
i.u = g
i.x = g
i.t = h
d.u = g
d.t = k
d.x = a
k.p = a
k.v = l
a.q = g
a.u = g
a.s = e
assert a.q.s.x.v.p.p.p.x.txt == "k"