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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.t: G = None
        self.o: D = None
        self.y: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.p: F = None
        self.o: B = None
        self.v: F = None
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: C = None
        self.r: C = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.t: G = None
        self.o: D = None
        self.y: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.p: F = None
        self.o: B = None
        self.v: F = None
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: C = None
        self.r: C = None
        self.txt = txt

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

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

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