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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: H = None
        self.r: A = None
        self.y: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: C = None
        self.x: E = None
        self.y: H = None
        self.z: H = None
        self.o: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: D = None
        self.r: I = None
        self.o: H = None
        self.q: H = None
        self.u: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: H = None
        self.z: G = None
        self.y: G = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.v: I = None
        self.p: I = None
        self.x: C = None
        self.t: I = None
        self.r: F = None
        self.w: F = None
        self.txt = txt

b = A("b")
l = B("l")
f = C("f")
e = D("e")
d = E("d")
m = F("m")
g = G("g")
n = H("n")
k = I("k")
c = J("c")

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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: H = None
        self.r: A = None
        self.y: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: C = None
        self.x: E = None
        self.y: H = None
        self.z: H = None
        self.o: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: D = None
        self.r: I = None
        self.o: H = None
        self.q: H = None
        self.u: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: H = None
        self.z: G = None
        self.y: G = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.v: I = None
        self.p: I = None
        self.x: C = None
        self.t: I = None
        self.r: F = None
        self.w: F = None
        self.txt = txt

b = A("b")
l = B("l")
f = C("f")
e = D("e")
d = E("d")
m = F("m")
g = G("g")
n = H("n")
k = I("k")
c = J("c")

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