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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: D = None
        self.r: C = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

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

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

k.w = a
n.t = k
n.p = a
n.q = a
n.r = l
g.x = f
g.s = f
g.v = k
a.s = m
a.z = c
a.y = c
a.x = d
a.p = f
a.o = n
d.p = f
d.s = f
d.o = g
c.v = k
m.x = k
m.r = a
m.o = a
m.z = d
f.q = m
l.x = f
l.s = f
l.v = k
assert k.w.p.q.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: D = None
        self.r: C = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

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

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

k.w = a
n.t = k
n.p = a
n.q = a
n.r = l
g.x = f
g.s = f
g.v = k
a.s = m
a.z = c
a.y = c
a.x = d
a.p = f
a.o = n
d.p = f
d.s = f
d.o = g
c.v = k
m.x = k
m.r = a
m.o = a
m.z = d
f.q = m
l.x = f
l.s = f
l.v = k
assert k.w.p.q.x.w.txt == "a"