class A:
    def __init__(self, txt: str):
        self.q: H = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: F = None
        self.r: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.y: D = None
        self.x: B = None
        self.v: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.v: E = None
        self.y: C = None
        self.p: B = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: F = None
        self.r: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.y: D = None
        self.x: B = None
        self.v: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.v: E = None
        self.y: C = None
        self.p: B = None
        self.txt = txt

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

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

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