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

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

class C:
    def __init__(self, txt: str):
        self.w: G = None
        self.r: F = None
        self.q: F = None
        self.u: A = None
        self.s: G = None
        self.p: F = None
        self.y: A = None
        self.txt = txt

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

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

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

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

d = A("d")
a = B("a")
b = C("b")
e = D("e")
m = E("m")
k = F("k")
h = G("h")

d.x = e
d.p = b
d.z = h
d.r = h
d.q = m
a.v = m
a.u = m
a.y = b
a.o = e
a.q = h
a.r = d
b.w = h
b.s = h
b.r = k
b.q = k
b.p = k
b.u = d
b.y = d
e.s = b
e.q = d
m.z = a
k.q = a
h.p = b
assert e.q.x.s.u.r.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: C = None
        self.z: G = None
        self.r: G = None
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: G = None
        self.r: F = None
        self.q: F = None
        self.u: A = None
        self.s: G = None
        self.p: F = None
        self.y: A = None
        self.txt = txt

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

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

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

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

d = A("d")
a = B("a")
b = C("b")
e = D("e")
m = E("m")
k = F("k")
h = G("h")

d.x = e
d.p = b
d.z = h
d.r = h
d.q = m
a.v = m
a.u = m
a.y = b
a.o = e
a.q = h
a.r = d
b.w = h
b.s = h
b.r = k
b.q = k
b.p = k
b.u = d
b.y = d
e.s = b
e.q = d
m.z = a
k.q = a
h.p = b
assert e.q.x.s.u.r.p.u.txt == "d"