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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: E = None
        self.w: E = None
        self.r: G = None
        self.q: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: E = None
        self.s: F = None
        self.x: G = None
        self.z: E = None
        self.w: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: A = None
        self.t: A = None
        self.v: H = None
        self.y: C = None
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: A = None
        self.v: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: D = None
        self.r: G = None
        self.t: A = None
        self.txt = txt

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

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

d = A("d")
i = B("i")
c = C("c")
g = D("g")
n = E("n")
b = F("b")
h = G("h")
l = H("l")

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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: E = None
        self.w: E = None
        self.r: G = None
        self.q: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: E = None
        self.s: F = None
        self.x: G = None
        self.z: E = None
        self.w: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: A = None
        self.t: A = None
        self.v: H = None
        self.y: C = None
        self.z: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: A = None
        self.v: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: D = None
        self.r: G = None
        self.t: A = None
        self.txt = txt

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

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

d = A("d")
i = B("i")
c = C("c")
g = D("g")
n = E("n")
b = F("b")
h = G("h")
l = H("l")

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