class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.u: H = None
        self.t: B = None
        self.w: D = None
        self.x: E = None
        self.q: B = None
        self.p: D = None
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: H = None
        self.txt = txt

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: A = None
        self.txt = txt

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

b.o = n
b.u = l
b.t = c
b.q = c
b.r = c
b.w = k
b.p = k
b.x = f
c.z = l
g.u = l
g.x = k
g.t = k
k.p = n
k.s = c
k.q = d
k.z = d
k.u = f
k.t = l
f.t = b
f.p = b
f.o = k
f.x = d
f.w = g
f.u = n
d.x = k
d.o = c
d.r = g
n.o = f
n.u = f
n.x = g
n.z = g
n.s = d
l.p = g
l.s = b
assert l.p.t.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.u: H = None
        self.t: B = None
        self.w: D = None
        self.x: E = None
        self.q: B = None
        self.p: D = None
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: H = None
        self.txt = txt

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: A = None
        self.txt = txt

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

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