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

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

class C:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

k = A("k")
e = B("e")
i = C("i")
m = D("m")
g = E("g")
f = F("f")
j = G("j")

k.q = j
k.s = j
e.w = g
e.t = m
e.p = m
e.v = f
e.q = f
e.u = i
e.x = k
i.x = j
m.q = e
m.z = e
m.w = k
m.u = g
m.r = j
g.t = f
g.w = i
f.p = i
j.t = g
assert i.x.t.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.s: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

k = A("k")
e = B("e")
i = C("i")
m = D("m")
g = E("g")
f = F("f")
j = G("j")

k.q = j
k.s = j
e.w = g
e.t = m
e.p = m
e.v = f
e.q = f
e.u = i
e.x = k
i.x = j
m.q = e
m.z = e
m.w = k
m.u = g
m.r = j
g.t = f
g.w = i
f.p = i
j.t = g
assert i.x.t.t.p.txt == "i"