class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: E = None
        self.z: C = None
        self.o: C = None
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: F = None
        self.o: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: E = None
        self.o: F = None
        self.q: B = None
        self.txt = txt

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

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

a = A("a")
c = B("c")
h = C("h")
d = D("d")
n = E("n")
l = F("l")
m = D("m")
b = C("b")

a.y = h
a.z = h
a.o = h
a.r = n
a.p = n
c.s = n
c.o = n
c.p = n
c.y = m
h.s = n
h.w = l
h.o = a
d.x = h
d.p = n
d.o = l
d.q = c
n.x = m
l.v = b
l.z = n
m.x = b
m.p = n
m.o = l
m.q = c
b.s = n
b.w = l
b.o = a
assert m.o.v.w.z.x.o.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: E = None
        self.z: C = None
        self.o: C = None
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: F = None
        self.o: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: E = None
        self.o: F = None
        self.q: B = None
        self.txt = txt

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

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

a = A("a")
c = B("c")
h = C("h")
d = D("d")
n = E("n")
l = F("l")
m = D("m")
b = C("b")

a.y = h
a.z = h
a.o = h
a.r = n
a.p = n
c.s = n
c.o = n
c.p = n
c.y = m
h.s = n
h.w = l
h.o = a
d.x = h
d.p = n
d.o = l
d.q = c
n.x = m
l.v = b
l.z = n
m.x = b
m.p = n
m.o = l
m.q = c
b.s = n
b.w = l
b.o = a
assert m.o.v.w.z.x.o.v.s.txt == "n"