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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.w: E = None
        self.v: G = None
        self.z: E = None
        self.q: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.o: A = None
        self.x: G = None
        self.u: E = None
        self.q: C = None
        self.w: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

n = A("n")
d = B("d")
j = C("j")
c = D("c")
f = E("f")
g = F("g")
l = G("l")
b = H("b")
k = H("k")

n.s = c
n.u = c
n.q = d
n.w = j
n.y = f
d.s = n
d.w = f
d.z = f
d.v = l
d.q = j
j.x = g
j.z = c
j.r = f
c.z = l
c.x = l
c.o = n
c.u = f
c.q = j
c.w = k
f.u = n
g.s = f
l.z = c
l.u = d
b.p = j
k.p = j
assert n.q.s.y.u.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: D = None
        self.q: B = None
        self.w: C = None
        self.y: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.w: E = None
        self.v: G = None
        self.z: E = None
        self.q: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.o: A = None
        self.x: G = None
        self.u: E = None
        self.q: C = None
        self.w: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

n = A("n")
d = B("d")
j = C("j")
c = D("c")
f = E("f")
g = F("g")
l = G("l")
b = H("b")
k = H("k")

n.s = c
n.u = c
n.q = d
n.w = j
n.y = f
d.s = n
d.w = f
d.z = f
d.v = l
d.q = j
j.x = g
j.z = c
j.r = f
c.z = l
c.x = l
c.o = n
c.u = f
c.q = j
c.w = k
f.u = n
g.s = f
l.z = c
l.u = d
b.p = j
k.p = j
assert n.q.s.y.u.w.x.txt == "g"