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

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: B = None
        self.t: J = None
        self.p: H = None
        self.r: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: H = None
        self.u: I = None
        self.r: B = None
        self.y: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: F = None
        self.w: B = None
        self.u: F = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: I = None
        self.u: G = None
        self.s: B = None
        self.z: A = None
        self.w: A = None
        self.t: I = None
        self.r: I = None
        self.q: B = None
        self.v: D = None
        self.txt = txt

a = A("a")
j = B("j")
c = C("c")
f = D("f")
l = E("l")
g = F("g")
h = G("h")
b = H("b")
i = I("i")
n = J("n")

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

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: B = None
        self.t: J = None
        self.p: H = None
        self.r: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: H = None
        self.u: I = None
        self.r: B = None
        self.y: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: F = None
        self.w: B = None
        self.u: F = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: I = None
        self.u: G = None
        self.s: B = None
        self.z: A = None
        self.w: A = None
        self.t: I = None
        self.r: I = None
        self.q: B = None
        self.v: D = None
        self.txt = txt

a = A("a")
j = B("j")
c = C("c")
f = D("f")
l = E("l")
g = F("g")
h = G("h")
b = H("b")
i = I("i")
n = J("n")

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