class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.v: D = None
        self.u: D = None
        self.x: A = None
        self.s: C = None
        self.o: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: E = None
        self.y: B = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: E = None
        self.y: B = None
        self.p: D = None
        self.txt = txt

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

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