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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: E = None
        self.r: A = None
        self.t: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: C = None
        self.v: B = None
        self.y: A = None
        self.x: B = None
        self.q: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

c = A("c")
n = B("n")
g = C("g")
i = D("i")
f = E("f")
a = F("a")
l = D("l")
j = A("j")
d = E("d")

c.p = f
c.y = a
n.z = c
n.t = c
n.q = d
n.r = j
g.w = d
i.s = a
i.t = c
i.x = c
f.p = l
f.t = g
f.q = g
f.v = n
f.x = n
f.y = j
a.v = f
l.s = a
l.t = j
l.x = c
j.p = d
j.y = a
d.p = i
d.t = g
d.q = g
d.v = n
d.x = n
d.y = c
assert d.p.x.p.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: E = None
        self.r: A = None
        self.t: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: C = None
        self.v: B = None
        self.y: A = None
        self.x: B = None
        self.q: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

c = A("c")
n = B("n")
g = C("g")
i = D("i")
f = E("f")
a = F("a")
l = D("l")
j = A("j")
d = E("d")

c.p = f
c.y = a
n.z = c
n.t = c
n.q = d
n.r = j
g.w = d
i.s = a
i.t = c
i.x = c
f.p = l
f.t = g
f.q = g
f.v = n
f.x = n
f.y = j
a.v = f
l.s = a
l.t = j
l.x = c
j.p = d
j.y = a
d.p = i
d.t = g
d.q = g
d.v = n
d.x = n
d.y = c
assert d.p.x.p.q.w.txt == "d"