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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: B = None
        self.p: F = None
        self.t: B = None
        self.r: A = None
        self.x: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: B = None
        self.o: A = None
        self.v: F = None
        self.txt = txt

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

m = A("m")
g = B("g")
c = C("c")
a = D("a")
l = E("l")
e = F("e")
h = E("h")
k = E("k")

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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: B = None
        self.p: F = None
        self.t: B = None
        self.r: A = None
        self.x: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: B = None
        self.o: A = None
        self.v: F = None
        self.txt = txt

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

m = A("m")
g = B("g")
c = C("c")
a = D("a")
l = E("l")
e = F("e")
h = E("h")
k = E("k")

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