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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: D = None
        self.o: A = None
        self.txt = txt

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

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: D = None
        self.o: A = None
        self.txt = txt

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

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

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

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

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

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