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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: B = None
        self.z: G = None
        self.u: D = None
        self.s: A = None
        self.r: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: A = None
        self.p: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: E = None
        self.r: F = None
        self.x: D = None
        self.w: C = None
        self.t: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: B = None
        self.z: G = None
        self.u: D = None
        self.s: A = None
        self.r: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: A = None
        self.p: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: E = None
        self.r: F = None
        self.x: D = None
        self.w: C = None
        self.t: B = None
        self.txt = txt

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

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