class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.r: A = None
        self.p: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

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

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

k.q = a
a.r = k
a.x = b
g.s = l
g.w = i
d.o = b
d.p = b
d.r = k
l.x = k
b.y = l
b.w = l
b.p = l
b.o = a
b.r = a
b.s = g
b.z = i
b.u = d
f.t = k
f.z = k
f.p = i
i.u = d
i.x = g
i.r = g
i.q = k
assert l.x.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.r: A = None
        self.p: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

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

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

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