class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: G = None
        self.o: C = None
        self.z: C = None
        self.p: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: A = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: A = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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