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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: F = None
        self.p: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.z: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: E = None
        self.s: E = None
        self.o: F = None
        self.r: A = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: F = None
        self.p: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.z: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: E = None
        self.s: E = None
        self.o: F = None
        self.r: A = None
        self.txt = txt

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

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