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

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

class C:
    def __init__(self, txt: str):
        self.o: H = None
        self.p: A = None
        self.q: D = None
        self.y: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: G = None
        self.s: E = None
        self.u: E = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: D = None
        self.t: F = None
        self.p: H = None
        self.w: H = None
        self.s: C = None
        self.r: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: H = None
        self.o: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: B = None
        self.txt = txt

c = A("c")
m = B("m")
a = C("a")
f = D("f")
j = E("j")
d = F("d")
h = G("h")
k = H("k")

c.o = k
c.x = a
c.y = h
c.q = d
m.t = a
a.o = k
a.p = c
a.q = f
a.y = d
f.p = h
f.o = h
f.s = j
f.u = j
j.q = m
j.x = f
j.t = d
j.p = k
j.w = k
j.s = a
j.r = c
d.o = a
d.x = k
h.t = k
h.o = m
k.o = f
k.s = m
assert c.q.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: H = None
        self.x: C = None
        self.y: G = None
        self.q: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: H = None
        self.p: A = None
        self.q: D = None
        self.y: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: G = None
        self.s: E = None
        self.u: E = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: D = None
        self.t: F = None
        self.p: H = None
        self.w: H = None
        self.s: C = None
        self.r: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: H = None
        self.o: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: B = None
        self.txt = txt

c = A("c")
m = B("m")
a = C("a")
f = D("f")
j = E("j")
d = F("d")
h = G("h")
k = H("k")

c.o = k
c.x = a
c.y = h
c.q = d
m.t = a
a.o = k
a.p = c
a.q = f
a.y = d
f.p = h
f.o = h
f.s = j
f.u = j
j.q = m
j.x = f
j.t = d
j.p = k
j.w = k
j.s = a
j.r = c
d.o = a
d.x = k
h.t = k
h.o = m
k.o = f
k.s = m
assert c.q.x.o.txt == "f"