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

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: D = None
        self.p: D = None
        self.r: A = None
        self.y: A = None
        self.txt = txt

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

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

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

m = A("m")
j = B("j")
d = C("d")
f = D("f")
b = E("b")
a = F("a")

m.x = b
m.o = b
m.z = f
m.y = f
j.x = d
j.y = d
j.w = a
j.s = a
j.u = f
d.v = f
d.u = f
d.p = f
d.r = m
d.y = m
f.o = a
f.v = a
f.r = b
b.x = d
b.q = a
a.s = f
a.x = j
assert d.r.y.o.s.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.o: E = None
        self.z: D = None
        self.y: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: D = None
        self.p: D = None
        self.r: A = None
        self.y: A = None
        self.txt = txt

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

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

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

m = A("m")
j = B("j")
d = C("d")
f = D("f")
b = E("b")
a = F("a")

m.x = b
m.o = b
m.z = f
m.y = f
j.x = d
j.y = d
j.w = a
j.s = a
j.u = f
d.v = f
d.u = f
d.p = f
d.r = m
d.y = m
f.o = a
f.v = a
f.r = b
b.x = d
b.q = a
a.s = f
a.x = j
assert d.r.y.o.s.o.s.txt == "f"