class A:
    def __init__(self, txt: str):
        self.x: H = None
        self.p: H = None
        self.y: H = None
        self.q: B = None
        self.o: H = None
        self.r: H = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: A = None
        self.w: H = None
        self.s: H = None
        self.p: D = None
        self.o: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

n = A("n")
g = B("g")
l = C("l")
f = D("f")
i = E("i")
a = F("a")
e = G("e")
m = H("m")
j = B("j")

n.x = m
n.p = m
n.y = m
n.o = m
n.r = m
n.q = g
g.t = a
g.s = a
g.r = j
l.u = e
l.w = n
f.o = e
f.z = e
f.v = n
i.q = l
i.y = j
a.r = n
a.x = n
a.w = m
a.s = m
a.p = f
a.o = l
e.y = l
m.x = a
j.t = a
j.s = a
j.r = g
assert n.r.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: H = None
        self.p: H = None
        self.y: H = None
        self.q: B = None
        self.o: H = None
        self.r: H = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: A = None
        self.w: H = None
        self.s: H = None
        self.p: D = None
        self.o: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

n = A("n")
g = B("g")
l = C("l")
f = D("f")
i = E("i")
a = F("a")
e = G("e")
m = H("m")
j = B("j")

n.x = m
n.p = m
n.y = m
n.o = m
n.r = m
n.q = g
g.t = a
g.s = a
g.r = j
l.u = e
l.w = n
f.o = e
f.z = e
f.v = n
i.q = l
i.y = j
a.r = n
a.x = n
a.w = m
a.s = m
a.p = f
a.o = l
e.y = l
m.x = a
j.t = a
j.s = a
j.r = g
assert n.r.x.o.txt == "l"