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

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

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.t: D = None
        self.u: B = None
        self.z: F = None
        self.s: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.t: G = None
        self.x: B = None
        self.s: D = None
        self.v: A = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.t: D = None
        self.u: B = None
        self.z: F = None
        self.s: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.t: G = None
        self.x: B = None
        self.s: D = None
        self.v: A = None
        self.txt = txt

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

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

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