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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: G = None
        self.q: A = None
        self.v: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.o: B = None
        self.u: E = None
        self.q: E = None
        self.r: E = None
        self.txt = txt

d = A("d")
k = B("k")
m = C("m")
l = D("l")
n = E("n")
e = F("e")
b = G("b")
c = G("c")
g = C("g")
h = A("h")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: G = None
        self.q: A = None
        self.v: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.o: B = None
        self.u: E = None
        self.q: E = None
        self.r: E = None
        self.txt = txt

d = A("d")
k = B("k")
m = C("m")
l = D("l")
n = E("n")
e = F("e")
b = G("b")
c = G("c")
g = C("g")
h = A("h")

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