class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: D = None
        self.q: A = None
        self.y: H = None
        self.o: B = None
        self.x: B = None
        self.r: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: E = None
        self.o: D = None
        self.x: E = None
        self.w: B = None
        self.v: G = None
        self.r: F = None
        self.txt = txt

b = A("b")
m = B("m")
a = C("a")
i = D("i")
d = E("d")
k = F("k")
c = G("c")
g = H("g")
l = E("l")

b.o = k
m.p = a
m.s = l
a.q = i
i.o = a
d.x = b
d.r = i
k.u = a
k.w = i
k.q = b
k.y = g
k.o = m
k.x = m
k.r = c
c.o = k
g.y = a
g.z = d
g.x = d
g.o = i
g.w = m
g.v = c
g.r = k
l.x = b
l.r = i
assert a.q.o.q.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: D = None
        self.q: A = None
        self.y: H = None
        self.o: B = None
        self.x: B = None
        self.r: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: E = None
        self.o: D = None
        self.x: E = None
        self.w: B = None
        self.v: G = None
        self.r: F = None
        self.txt = txt

b = A("b")
m = B("m")
a = C("a")
i = D("i")
d = E("d")
k = F("k")
c = G("c")
g = H("g")
l = E("l")

b.o = k
m.p = a
m.s = l
a.q = i
i.o = a
d.x = b
d.r = i
k.u = a
k.w = i
k.q = b
k.y = g
k.o = m
k.x = m
k.r = c
c.o = k
g.y = a
g.z = d
g.x = d
g.o = i
g.w = m
g.v = c
g.r = k
l.x = b
l.r = i
assert a.q.o.q.o.q.txt == "i"