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

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

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: E = None
        self.x: E = None
        self.o: E = None
        self.q: F = None
        self.txt = txt

n = A("n")
m = B("m")
l = C("l")
d = D("d")
f = E("f")
h = F("h")
a = G("a")
b = F("b")
i = D("i")

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

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

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: E = None
        self.x: E = None
        self.o: E = None
        self.q: F = None
        self.txt = txt

n = A("n")
m = B("m")
l = C("l")
d = D("d")
f = E("f")
h = F("h")
a = G("a")
b = F("b")
i = D("i")

n.q = m
n.r = m
n.t = m
n.w = m
n.x = l
m.y = l
m.s = l
m.w = a
l.w = h
d.x = m
f.o = m
f.v = m
f.t = m
f.p = a
f.r = n
h.s = l
h.x = n
a.u = m
a.t = f
a.x = f
a.o = f
a.q = h
b.s = l
b.x = n
i.x = m
assert l.w.x.x.w.s.w.s.w.txt == "h"