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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: J = None
        self.s: J = None
        self.t: D = None
        self.u: H = None
        self.w: H = None
        self.p: F = None
        self.o: C = None
        self.v: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: G = None
        self.z: D = None
        self.s: I = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.u: A = None
        self.s: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: G = 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: J = None
        self.p: C = None
        self.o: B = None
        self.q: G = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: J = None
        self.s: J = None
        self.t: D = None
        self.u: H = None
        self.w: H = None
        self.p: F = None
        self.o: C = None
        self.v: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: G = None
        self.z: D = None
        self.s: I = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.u: A = None
        self.s: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: G = 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: J = None
        self.p: C = None
        self.o: B = None
        self.q: G = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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