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

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

class C:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: B = None
        self.q: C = None
        self.t: C = None
        self.o: B = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: A = None
        self.z: B = None
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.q: D = None
        self.o: D = None
        self.r: E = None
        self.u: D = None
        self.x: H = None
        self.p: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.y: G = None
        self.r: D = None
        self.s: E = None
        self.p: E = None
        self.u: F = None
        self.z: F = None
        self.txt = txt

n = A("n")
d = B("d")
f = C("f")
e = D("e")
m = E("m")
g = F("g")
b = G("b")
c = H("c")

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

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

class C:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: B = None
        self.q: C = None
        self.t: C = None
        self.o: B = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: A = None
        self.z: B = None
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.q: D = None
        self.o: D = None
        self.r: E = None
        self.u: D = None
        self.x: H = None
        self.p: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.y: G = None
        self.r: D = None
        self.s: E = None
        self.p: E = None
        self.u: F = None
        self.z: F = None
        self.txt = txt

n = A("n")
d = B("d")
f = C("f")
e = D("e")
m = E("m")
g = F("g")
b = G("b")
c = H("c")

n.r = b
n.t = f
n.w = f
d.w = g
d.u = f
d.p = e
f.s = b
f.z = m
e.u = f
e.q = f
e.t = f
e.z = d
e.o = d
e.r = d
m.o = d
m.z = d
m.t = n
m.x = g
g.y = b
g.q = e
g.o = e
g.u = e
g.r = m
g.x = c
g.p = f
b.u = d
c.y = b
c.r = e
c.s = m
c.p = m
c.u = g
c.z = g
assert g.q.r.u.txt == "f"