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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: C = None
        self.p: A = None
        self.s: B = None
        self.z: G = None
        self.u: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: C = None
        self.v: C = None
        self.y: B = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: C = None
        self.p: A = None
        self.s: B = None
        self.z: G = None
        self.u: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.o: C = None
        self.v: C = None
        self.y: B = None
        self.z: D = None
        self.txt = txt

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

k.q = d
k.s = f
k.r = n
h.v = f
h.p = n
l.p = k
d.p = b
d.r = b
d.o = e
d.x = l
n.v = j
n.p = j
n.x = l
n.u = l
n.s = h
n.z = b
e.s = n
b.q = h
b.y = h
b.o = l
b.v = l
b.z = d
j.q = f
j.s = f
j.r = n
f.p = b
f.r = b
f.o = e
f.x = l
assert f.o.s.u.p.s.p.z.p.txt == "b"