class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: F = None
        self.x: D = None
        self.s: B = None
        self.txt = txt

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

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

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

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

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

m = A("m")
n = B("n")
f = C("f")
c = D("c")
a = E("a")
l = F("l")

m.p = c
m.x = c
m.q = l
m.s = n
n.p = a
n.r = m
f.t = c
f.o = a
f.v = a
f.r = n
c.w = f
c.v = f
a.v = m
a.p = l
a.x = l
a.s = f
a.o = c
l.r = m
l.q = m
assert m.p.w.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: F = None
        self.x: D = None
        self.s: B = None
        self.txt = txt

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

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

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

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

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

m = A("m")
n = B("n")
f = C("f")
c = D("c")
a = E("a")
l = F("l")

m.p = c
m.x = c
m.q = l
m.s = n
n.p = a
n.r = m
f.t = c
f.o = a
f.v = a
f.r = n
c.w = f
c.v = f
a.v = m
a.p = l
a.x = l
a.s = f
a.o = c
l.r = m
l.q = m
assert m.p.w.o.o.txt == "c"