class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: G = None
        self.p: G = None
        self.z: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: C = None
        self.u: C = None
        self.w: E = None
        self.s: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: H = None
        self.z: B = None
        self.u: E = None
        self.x: A = None
        self.t: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: D = None
        self.t: D = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: C = None
        self.u: C = None
        self.w: E = None
        self.s: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: H = None
        self.z: B = None
        self.u: E = None
        self.x: A = None
        self.t: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.x: D = None
        self.t: D = None
        self.txt = txt

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

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

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