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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: B = None
        self.txt = txt

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

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

j.u = l
j.x = l
i.t = k
e.t = n
l.s = n
l.x = n
l.z = k
l.r = e
l.p = i
l.y = i
l.u = g
g.s = k
k.t = l
k.z = i
n.q = j
assert k.t.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: B = None
        self.txt = txt

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

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

j.u = l
j.x = l
i.t = k
e.t = n
l.s = n
l.x = n
l.z = k
l.r = e
l.p = i
l.y = i
l.u = g
g.s = k
k.t = l
k.z = i
n.q = j
assert k.t.x.q.txt == "j"