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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: G = None
        self.p: C = None
        self.y: G = None
        self.o: G = None
        self.u: A = None
        self.txt = txt

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

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

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

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

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

m = A("m")
n = B("n")
d = C("d")
c = D("c")
h = E("h")
j = F("j")
k = G("k")
f = F("f")
g = E("g")

m.t = d
n.t = j
n.v = k
n.y = k
n.o = k
n.p = d
n.u = m
d.r = c
d.v = c
d.z = m
c.q = d
c.w = d
h.x = g
h.t = m
h.u = c
h.o = c
h.z = c
j.w = n
j.y = m
j.t = k
k.z = f
k.y = c
f.w = n
f.y = m
f.t = k
g.x = h
g.t = m
g.u = c
g.o = c
g.z = c
assert m.t.v.q.z.t.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: G = None
        self.p: C = None
        self.y: G = None
        self.o: G = None
        self.u: A = None
        self.txt = txt

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

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

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

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

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

m = A("m")
n = B("n")
d = C("d")
c = D("c")
h = E("h")
j = F("j")
k = G("k")
f = F("f")
g = E("g")

m.t = d
n.t = j
n.v = k
n.y = k
n.o = k
n.p = d
n.u = m
d.r = c
d.v = c
d.z = m
c.q = d
c.w = d
h.x = g
h.t = m
h.u = c
h.o = c
h.z = c
j.w = n
j.y = m
j.t = k
k.z = f
k.y = c
f.w = n
f.y = m
f.t = k
g.x = h
g.t = m
g.u = c
g.o = c
g.z = c
assert m.t.v.q.z.t.v.q.txt == "d"