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

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: F = None
        self.y: F = None
        self.z: D = None
        self.w: A = None
        self.q: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: G = None
        self.v: B = None
        self.u: E = None
        self.x: A = None
        self.t: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: D = None
        self.r: C = None
        self.t: E = None
        self.w: D = None
        self.txt = txt

l = A("l")
c = B("c")
f = C("f")
n = D("n")
i = E("i")
j = F("j")
m = G("m")

l.q = f
c.p = j
f.u = n
f.z = n
f.r = j
f.y = j
f.w = l
f.q = i
n.q = i
n.u = i
n.p = m
n.v = c
n.t = c
n.x = l
i.t = n
i.w = j
i.s = l
i.p = l
i.o = l
i.y = f
i.q = m
j.w = c
m.q = n
m.o = n
m.w = n
m.r = f
m.t = i
assert l.q.w.q.q.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: F = None
        self.y: F = None
        self.z: D = None
        self.w: A = None
        self.q: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: G = None
        self.v: B = None
        self.u: E = None
        self.x: A = None
        self.t: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: D = None
        self.r: C = None
        self.t: E = None
        self.w: D = None
        self.txt = txt

l = A("l")
c = B("c")
f = C("f")
n = D("n")
i = E("i")
j = F("j")
m = G("m")

l.q = f
c.p = j
f.u = n
f.z = n
f.r = j
f.y = j
f.w = l
f.q = i
n.q = i
n.u = i
n.p = m
n.v = c
n.t = c
n.x = l
i.t = n
i.w = j
i.s = l
i.p = l
i.o = l
i.y = f
i.q = m
j.w = c
m.q = n
m.o = n
m.w = n
m.r = f
m.t = i
assert l.q.w.q.q.q.t.txt == "i"