class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.q: C = None
        self.o: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: H = None
        self.x: A = None
        self.t: F = None
        self.p: H = None
        self.z: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: H = None
        self.q: F = None
        self.v: B = None
        self.y: A = None
        self.p: H = None
        self.r: C = None
        self.s: F = None
        self.txt = txt

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

n = A("n")
b = B("b")
a = C("a")
e = D("e")
m = E("m")
h = F("h")
l = G("l")
g = H("g")

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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: H = None
        self.x: A = None
        self.t: F = None
        self.p: H = None
        self.z: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: H = None
        self.q: F = None
        self.v: B = None
        self.y: A = None
        self.p: H = None
        self.r: C = None
        self.s: F = None
        self.txt = txt

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

n = A("n")
b = B("b")
a = C("a")
e = D("e")
m = E("m")
h = F("h")
l = G("l")
g = H("g")

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