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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: C = None
        self.q: A = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: C = None
        self.q: A = None
        self.txt = txt

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

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

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