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

class B:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.r: A = None
        self.x: E = None
        self.p: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: F = None
        self.p: D = None
        self.x: F = None
        self.txt = txt

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

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

d = A("d")
h = B("h")
f = C("f")
b = D("b")
l = E("l")
k = F("k")
n = G("n")

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

class B:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.r: A = None
        self.x: E = None
        self.p: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: F = None
        self.p: D = None
        self.x: F = None
        self.txt = txt

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

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

d = A("d")
h = B("h")
f = C("f")
b = D("b")
l = E("l")
k = F("k")
n = G("n")

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