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

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: H = None
        self.x: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.r: A = None
        self.y: J = None
        self.q: I = None
        self.z: G = None
        self.w: G = None
        self.v: C = None
        self.o: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: E = None
        self.o: D = None
        self.u: B = None
        self.w: J = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.r: G = None
        self.w: B = None
        self.o: F = None
        self.s: E = None
        self.txt = txt

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

b.r = c
b.q = n
b.s = n
b.u = n
b.p = a
b.t = e
g.s = h
g.x = h
g.z = a
n.y = g
n.p = c
l.r = g
l.y = c
c.x = a
c.w = e
m.p = c
m.r = b
m.y = e
m.q = f
m.z = h
m.w = h
m.v = n
m.o = n
h.t = c
a.z = m
a.y = c
a.o = l
a.u = g
a.w = e
f.z = m
e.r = h
e.w = g
e.o = m
e.s = c
assert h.t.w.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.q: C = None
        self.p: H = None
        self.s: C = None
        self.t: J = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: H = None
        self.x: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.r: A = None
        self.y: J = None
        self.q: I = None
        self.z: G = None
        self.w: G = None
        self.v: C = None
        self.o: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.z: F = None
        self.y: E = None
        self.o: D = None
        self.u: B = None
        self.w: J = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.r: G = None
        self.w: B = None
        self.o: F = None
        self.s: E = None
        self.txt = txt

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

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