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

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

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

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

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

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

m = A("m")
h = B("h")
j = C("j")
b = D("b")
i = E("i")
d = F("d")

m.w = b
m.o = b
m.p = j
m.s = j
m.x = h
h.x = b
j.u = i
j.x = d
b.t = i
b.r = d
i.p = j
i.o = j
i.w = d
i.v = b
i.r = m
d.y = m
d.x = m
d.r = h
assert d.r.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: C = None
        self.o: D = None
        self.x: B = None
        self.s: C = None
        self.txt = txt

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

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

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

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

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

m = A("m")
h = B("h")
j = C("j")
b = D("b")
i = E("i")
d = F("d")

m.w = b
m.o = b
m.p = j
m.s = j
m.x = h
h.x = b
j.u = i
j.x = d
b.t = i
b.r = d
i.p = j
i.o = j
i.w = d
i.v = b
i.r = m
d.y = m
d.x = m
d.r = h
assert d.r.x.t.txt == "i"