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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: A = None
        self.u: D = None
        self.v: D = None
        self.o: C = None
        self.txt = txt

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

f = A("f")
m = B("m")
e = C("e")
i = D("i")
g = E("g")
b = F("b")

f.x = m
f.o = m
f.w = m
f.r = e
f.y = e
f.v = i
m.z = i
e.r = g
e.u = g
e.q = b
e.x = b
i.u = m
g.p = m
g.z = f
g.u = i
g.v = i
g.o = e
b.x = i
b.p = g
b.y = e
b.r = f
assert b.p.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: B = None
        self.r: C = None
        self.w: B = None
        self.v: D = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: A = None
        self.u: D = None
        self.v: D = None
        self.o: C = None
        self.txt = txt

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

f = A("f")
m = B("m")
e = C("e")
i = D("i")
g = E("g")
b = F("b")

f.x = m
f.o = m
f.w = m
f.r = e
f.y = e
f.v = i
m.z = i
e.r = g
e.u = g
e.q = b
e.x = b
i.u = m
g.p = m
g.z = f
g.u = i
g.v = i
g.o = e
b.x = i
b.p = g
b.y = e
b.r = f
assert b.p.o.r.txt == "g"