class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: F = None
        self.x: D = None
        self.v: G = None
        self.q: E = None
        self.s: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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