class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: D = None
        self.q: F = None
        self.t: D = None
        self.p: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: D = None
        self.y: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: C = None
        self.o: E = None
        self.p: C = None
        self.txt = txt

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

k = A("k")
a = B("a")
n = C("n")
c = D("c")
i = E("i")
b = F("b")
f = G("f")
g = G("g")

k.y = c
k.z = c
k.t = c
k.q = b
k.p = i
a.s = n
a.u = c
a.y = b
n.o = b
c.s = a
c.o = b
i.t = b
i.q = c
i.x = c
i.p = g
i.s = k
i.o = f
b.w = i
b.o = i
b.u = n
b.p = n
f.y = a
g.y = a
assert k.q.p.o.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: D = None
        self.q: F = None
        self.t: D = None
        self.p: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: D = None
        self.y: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: C = None
        self.o: E = None
        self.p: C = None
        self.txt = txt

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

k = A("k")
a = B("a")
n = C("n")
c = D("c")
i = E("i")
b = F("b")
f = G("f")
g = G("g")

k.y = c
k.z = c
k.t = c
k.q = b
k.p = i
a.s = n
a.u = c
a.y = b
n.o = b
c.s = a
c.o = b
i.t = b
i.q = c
i.x = c
i.p = g
i.s = k
i.o = f
b.w = i
b.o = i
b.u = n
b.p = n
f.y = a
g.y = a
assert k.q.p.o.p.o.txt == "b"