class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: C = None
        self.q: E = None
        self.r: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: F = None
        self.q: E = None
        self.y: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: A = None
        self.v: C = None
        self.r: C = None
        self.u: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: B = None
        self.p: F = None
        self.x: A = None
        self.q: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: F = None
        self.q: E = None
        self.y: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: A = None
        self.v: C = None
        self.r: C = None
        self.u: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: B = None
        self.p: F = None
        self.x: A = None
        self.q: A = None
        self.txt = txt

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

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