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

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: A = None
        self.t: A = None
        self.txt = txt

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

g = A("g")
n = B("n")
a = C("a")
k = C("k")
e = B("e")
h = C("h")
j = A("j")
d = B("d")

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

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: A = None
        self.t: A = None
        self.txt = txt

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

g = A("g")
n = B("n")
a = C("a")
k = C("k")
e = B("e")
h = C("h")
j = A("j")
d = B("d")

g.s = h
g.w = a
g.p = j
n.y = h
n.q = g
n.t = g
a.x = n
a.y = n
a.u = g
k.x = n
k.y = n
k.u = j
e.y = a
e.q = g
e.t = j
h.x = e
h.y = d
h.u = g
j.s = k
j.w = k
j.p = g
d.y = k
d.q = g
d.t = j
assert d.t.p.p.p.s.txt == "h"