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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.z: D = None
        self.x: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.q: A = None
        self.w: B = None
        self.t: C = None
        self.r: A = None
        self.v: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: F = None
        self.y: B = None
        self.o: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: E = None
        self.r: B = None
        self.txt = txt

j = A("j")
i = B("i")
m = C("m")
n = D("n")
k = E("k")
g = F("g")
a = E("a")

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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.z: D = None
        self.x: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.q: A = None
        self.w: B = None
        self.t: C = None
        self.r: A = None
        self.v: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: F = None
        self.y: B = None
        self.o: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: E = None
        self.r: B = None
        self.txt = txt

j = A("j")
i = B("i")
m = C("m")
n = D("n")
k = E("k")
g = F("g")
a = E("a")

j.q = n
j.p = a
j.u = m
i.o = n
i.s = a
i.v = a
m.w = a
m.z = n
m.x = n
n.y = g
n.v = g
n.q = j
n.r = j
n.w = i
n.t = m
k.p = g
k.x = g
k.y = i
k.o = j
g.s = i
g.r = i
g.u = a
a.p = g
a.x = g
a.y = i
a.o = j
assert g.u.y.o.y.txt == "g"