class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.v: F = None
        self.x: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

b.z = a
b.v = g
b.x = c
h.s = b
h.q = c
h.x = g
c.y = h
c.q = i
m.o = b
a.w = h
k.q = c
i.o = b
i.x = b
g.q = c
assert k.q.y.q.q.o.x.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.v: F = None
        self.x: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

b.z = a
b.v = g
b.x = c
h.s = b
h.q = c
h.x = g
c.y = h
c.q = i
m.o = b
a.w = h
k.q = c
i.o = b
i.x = b
g.q = c
assert k.q.y.q.q.o.x.y.q.txt == "c"