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

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

class C:
    def __init__(self, txt: str):
        self.p: G = None
        self.r: B = None
        self.v: E = None
        self.t: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: G = None
        self.p: F = None
        self.t: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.x: G = None
        self.p: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: A = None
        self.q: A = None
        self.p: D = None
        self.x: B = None
        self.txt = txt

m = A("m")
h = B("h")
i = C("i")
k = D("k")
l = E("l")
n = F("n")
a = G("a")

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

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

class C:
    def __init__(self, txt: str):
        self.p: G = None
        self.r: B = None
        self.v: E = None
        self.t: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: G = None
        self.p: F = None
        self.t: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.x: G = None
        self.p: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: A = None
        self.q: A = None
        self.p: D = None
        self.x: B = None
        self.txt = txt

m = A("m")
h = B("h")
i = C("i")
k = D("k")
l = E("l")
n = F("n")
a = G("a")

m.u = a
m.q = a
m.r = l
m.t = i
h.q = l
i.p = a
i.r = h
i.t = h
i.v = l
k.r = n
l.s = a
l.t = a
l.p = n
n.t = l
n.x = a
n.p = i
a.o = m
a.z = m
a.q = m
a.p = k
a.x = h
assert a.p.r.x.x.q.txt == "l"