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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: D = None
        self.t: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.u: D = None
        self.y: A = None
        self.r: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: A = None
        self.s: A = None
        self.w: E = None
        self.txt = txt

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

k.q = j
k.v = b
k.t = f
d.o = g
d.p = f
d.r = h
b.w = d
b.r = g
b.t = h
j.r = g
j.u = g
j.p = f
j.w = b
j.o = d
j.z = i
f.q = h
f.u = g
f.r = g
f.y = i
h.u = b
h.t = k
h.s = i
h.w = f
i.q = g
i.v = b
i.t = f
g.r = j
g.u = j
g.p = f
g.w = b
g.o = d
g.z = i
assert d.r.t.v.r.p.y.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: C = None
        self.t: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: D = None
        self.t: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.u: D = None
        self.y: A = None
        self.r: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: A = None
        self.s: A = None
        self.w: E = None
        self.txt = txt

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

k.q = j
k.v = b
k.t = f
d.o = g
d.p = f
d.r = h
b.w = d
b.r = g
b.t = h
j.r = g
j.u = g
j.p = f
j.w = b
j.o = d
j.z = i
f.q = h
f.u = g
f.r = g
f.y = i
h.u = b
h.t = k
h.s = i
h.w = f
i.q = g
i.v = b
i.t = f
g.r = j
g.u = j
g.p = f
g.w = b
g.o = d
g.z = i
assert d.r.t.v.r.p.y.q.p.txt == "f"