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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: D = None
        self.t: A = None
        self.o: A = None
        self.txt = txt

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

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

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

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

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

m.s = a
m.y = k
m.t = g
k.u = e
k.r = m
h.q = k
h.y = a
h.t = m
h.o = m
a.p = k
g.o = h
g.z = a
b.y = k
b.r = a
b.s = h
b.t = e
j.v = m
j.x = a
e.q = k
e.y = a
e.t = m
e.o = m
assert h.q.u.q.u.o.y.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: B = None
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: D = None
        self.t: A = None
        self.o: A = None
        self.txt = txt

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

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

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

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

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

m.s = a
m.y = k
m.t = g
k.u = e
k.r = m
h.q = k
h.y = a
h.t = m
h.o = m
a.p = k
g.o = h
g.z = a
b.y = k
b.r = a
b.s = h
b.t = e
j.v = m
j.x = a
e.q = k
e.y = a
e.t = m
e.o = m
assert h.q.u.q.u.o.y.r.t.txt == "g"