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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: C = None
        self.o: C = None
        self.txt = txt

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

d = A("d")
i = B("i")
e = C("e")
m = D("m")
f = E("f")
h = F("h")
k = G("k")
n = B("n")

d.q = f
d.r = f
d.u = m
i.y = f
i.q = e
i.r = h
i.u = d
i.o = d
e.t = h
e.z = k
m.o = f
f.v = m
f.s = m
f.t = d
h.z = n
h.s = e
h.o = e
k.s = e
k.q = d
k.x = d
n.y = f
n.q = e
n.r = h
n.u = d
n.o = d
assert f.v.o.t.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: D = None
        self.r: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: C = None
        self.o: C = None
        self.txt = txt

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

d = A("d")
i = B("i")
e = C("e")
m = D("m")
f = E("f")
h = F("h")
k = G("k")
n = B("n")

d.q = f
d.r = f
d.u = m
i.y = f
i.q = e
i.r = h
i.u = d
i.o = d
e.t = h
e.z = k
m.o = f
f.v = m
f.s = m
f.t = d
h.z = n
h.s = e
h.o = e
k.s = e
k.q = d
k.x = d
n.y = f
n.q = e
n.r = h
n.u = d
n.o = d
assert f.v.o.t.u.o.txt == "f"