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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: I = None
        self.t: G = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: E = None
        self.s: E = None
        self.r: G = None
        self.q: F = None
        self.p: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: H = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: B = None
        self.w: C = None
        self.o: D = None
        self.txt = txt

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

n = A("n")
m = B("m")
b = C("b")
g = D("g")
k = E("k")
j = F("j")
e = G("e")
f = H("f")
h = I("h")
l = G("l")

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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: I = None
        self.t: G = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: E = None
        self.s: E = None
        self.r: G = None
        self.q: F = None
        self.p: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: H = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: B = None
        self.w: C = None
        self.o: D = None
        self.txt = txt

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

n = A("n")
m = B("m")
b = C("b")
g = D("g")
k = E("k")
j = F("j")
e = G("e")
f = H("f")
h = I("h")
l = G("l")

n.x = k
n.r = f
m.r = n
m.x = h
m.t = l
m.u = b
b.x = g
b.v = k
b.s = k
b.r = l
b.q = j
b.p = n
g.w = l
g.r = b
k.u = j
k.r = f
j.q = h
j.s = n
e.r = k
e.y = m
f.p = m
f.t = m
f.w = b
f.o = g
h.x = f
l.r = k
l.y = m
assert e.r.u.q.x.o.txt == "g"