class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: G = None
        self.r: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: G = None
        self.q: E = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: G = None
        self.y: C = None
        self.q: C = None
        self.o: E = None
        self.txt = txt

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

b = A("b")
a = B("a")
l = C("l")
h = D("h")
n = E("n")
c = F("c")
f = G("f")
m = E("m")

b.q = h
b.p = f
b.r = c
a.x = h
a.s = f
a.q = n
l.w = c
l.u = b
l.p = b
l.z = n
l.o = a
h.u = l
h.r = l
h.o = l
h.x = f
h.z = c
n.o = m
c.r = f
c.y = l
c.q = l
c.o = m
f.y = c
m.o = n
assert m.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: G = None
        self.r: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: G = None
        self.q: E = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: G = None
        self.y: C = None
        self.q: C = None
        self.o: E = None
        self.txt = txt

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

b = A("b")
a = B("a")
l = C("l")
h = D("h")
n = E("n")
c = F("c")
f = G("f")
m = E("m")

b.q = h
b.p = f
b.r = c
a.x = h
a.s = f
a.q = n
l.w = c
l.u = b
l.p = b
l.z = n
l.o = a
h.u = l
h.r = l
h.o = l
h.x = f
h.z = c
n.o = m
c.r = f
c.y = l
c.q = l
c.o = m
f.y = c
m.o = n
assert m.o.o.o.o.o.o.txt == "m"