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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: G = None
        self.r: C = None
        self.z: G = None
        self.w: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

d = A("d")
n = B("n")
i = C("i")
f = D("f")
g = E("g")
e = F("e")
c = G("c")
l = G("l")
k = C("k")

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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: G = None
        self.r: C = None
        self.z: G = None
        self.w: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

d = A("d")
n = B("n")
i = C("i")
f = D("f")
g = E("g")
e = F("e")
c = G("c")
l = G("l")
k = C("k")

d.p = e
n.t = d
i.t = f
i.q = c
i.z = c
i.r = k
i.w = n
f.s = n
f.q = n
g.p = d
g.v = i
e.u = f
e.q = f
e.z = g
c.z = k
l.z = i
k.t = f
k.q = c
k.z = c
k.r = i
k.w = n
assert e.z.p.p.q.q.t.txt == "d"