class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.v: B = None
        self.x: G = None
        self.z: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: B = None
        self.y: B = None
        self.w: D = None
        self.txt = txt

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

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

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

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

m = A("m")
k = B("k")
g = C("g")
d = D("d")
i = E("i")
j = F("j")
c = G("c")
h = A("h")

m.y = d
m.v = k
m.x = c
m.z = i
k.p = h
k.v = i
g.x = i
g.s = k
g.y = k
g.w = d
d.s = j
d.p = h
d.y = c
d.o = g
i.p = k
j.x = d
j.u = g
j.o = h
c.o = d
c.r = j
h.y = d
h.v = k
h.x = c
h.z = i
assert m.x.r.u.x.p.v.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.v: B = None
        self.x: G = None
        self.z: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: B = None
        self.y: B = None
        self.w: D = None
        self.txt = txt

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

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

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

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

m = A("m")
k = B("k")
g = C("g")
d = D("d")
i = E("i")
j = F("j")
c = G("c")
h = A("h")

m.y = d
m.v = k
m.x = c
m.z = i
k.p = h
k.v = i
g.x = i
g.s = k
g.y = k
g.w = d
d.s = j
d.p = h
d.y = c
d.o = g
i.p = k
j.x = d
j.u = g
j.o = h
c.o = d
c.r = j
h.y = d
h.v = k
h.x = c
h.z = i
assert m.x.r.u.x.p.v.p.p.txt == "h"