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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: B = None
        self.u: B = None
        self.z: F = None
        self.p: F = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: B = None
        self.u: B = None
        self.z: F = None
        self.p: F = None
        self.txt = txt

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

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