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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: E = None
        self.t: F = None
        self.u: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: E = None
        self.t: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: D = None
        self.r: A = None
        self.o: B = None
        self.q: B = None
        self.u: B = None
        self.w: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

a = A("a")
f = B("f")
j = C("j")
m = D("m")
d = E("d")
n = F("n")
c = G("c")
h = H("h")
b = H("b")
l = D("l")

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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: E = None
        self.t: F = None
        self.u: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: E = None
        self.t: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: D = None
        self.r: A = None
        self.o: B = None
        self.q: B = None
        self.u: B = None
        self.w: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

a = A("a")
f = B("f")
j = C("j")
m = D("m")
d = E("d")
n = F("n")
c = G("c")
h = H("h")
b = H("b")
l = D("l")

a.y = f
a.p = f
f.q = j
f.x = d
f.t = n
f.u = a
j.p = n
j.z = c
j.x = b
j.s = l
m.q = j
m.v = d
m.t = l
d.v = f
n.u = j
c.y = f
c.o = f
c.q = f
c.u = f
c.s = m
c.r = a
c.w = d
h.r = a
b.r = a
l.q = j
l.v = d
l.t = m
assert c.s.q.x.r.txt == "a"