class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: F = None
        self.y: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.q: A = None
        self.r: A = None
        self.v: D = None
        self.w: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.u: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: B = None
        self.p: G = None
        self.w: F = None
        self.x: B = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.q: A = None
        self.r: A = None
        self.v: D = None
        self.w: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.u: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: B = None
        self.p: G = None
        self.w: F = None
        self.x: B = None
        self.s: A = None
        self.txt = txt

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

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

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

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