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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: E = None
        self.t: E = None
        self.y: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: G = None
        self.p: E = None
        self.u: E = None
        self.y: A = None
        self.r: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: B = None
        self.w: F = None
        self.v: C = None
        self.z: A = None
        self.s: B = None
        self.y: D = None
        self.txt = txt

m = A("m")
j = B("j")
d = C("d")
n = D("n")
f = E("f")
c = F("c")
k = G("k")

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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: E = None
        self.t: E = None
        self.y: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: G = None
        self.p: E = None
        self.u: E = None
        self.y: A = None
        self.r: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: B = None
        self.w: F = None
        self.v: C = None
        self.z: A = None
        self.s: B = None
        self.y: D = None
        self.txt = txt

m = A("m")
j = B("j")
d = C("d")
n = D("n")
f = E("f")
c = F("c")
k = G("k")

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