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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.s: B = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: A = None
        self.t: C = None
        self.z: F = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: G = None
        self.u: F = None
        self.o: F = None
        self.y: G = None
        self.q: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: B = None
        self.s: E = None
        self.z: A = None
        self.u: F = None
        self.y: F = None
        self.o: C = None
        self.txt = txt

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

d.x = f
d.y = n
d.s = n
d.p = e
d.w = m
d.t = m
c.r = h
c.s = e
c.x = i
i.q = f
i.x = f
i.u = d
i.t = n
i.z = g
m.r = k
m.y = k
m.u = h
m.o = h
m.q = i
f.y = m
h.p = m
h.o = m
h.v = g
h.t = d
k.q = d
k.z = d
k.t = c
k.s = f
k.u = g
k.y = g
k.o = n
g.p = m
g.o = m
g.v = h
g.t = d
n.q = f
n.x = f
n.u = d
n.t = i
n.z = g
e.r = g
e.s = c
e.x = i
assert k.y.t.p.s.x.u.p.r.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: C = None
        self.p: B = None
        self.w: D = None
        self.t: D = None
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.s: B = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: A = None
        self.t: C = None
        self.z: F = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: G = None
        self.u: F = None
        self.o: F = None
        self.y: G = None
        self.q: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: B = None
        self.s: E = None
        self.z: A = None
        self.u: F = None
        self.y: F = None
        self.o: C = None
        self.txt = txt

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

d.x = f
d.y = n
d.s = n
d.p = e
d.w = m
d.t = m
c.r = h
c.s = e
c.x = i
i.q = f
i.x = f
i.u = d
i.t = n
i.z = g
m.r = k
m.y = k
m.u = h
m.o = h
m.q = i
f.y = m
h.p = m
h.o = m
h.v = g
h.t = d
k.q = d
k.z = d
k.t = c
k.s = f
k.u = g
k.y = g
k.o = n
g.p = m
g.o = m
g.v = h
g.t = d
n.q = f
n.x = f
n.u = d
n.t = i
n.z = g
e.r = g
e.s = c
e.x = i
assert k.y.t.p.s.x.u.p.r.v.t.txt == "d"