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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: B = None
        self.t: D = None
        self.y: B = None
        self.txt = txt

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

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

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

d = A("d")
i = B("i")
m = C("m")
e = D("e")
f = E("f")
j = F("j")
c = A("c")

d.p = e
d.z = m
d.w = c
i.s = m
i.x = m
m.p = i
m.r = i
m.y = i
m.t = e
e.u = i
e.x = f
f.x = j
f.w = j
f.o = d
f.r = d
f.p = i
j.r = m
j.w = e
j.t = e
j.s = f
c.p = e
c.z = m
c.w = d
assert c.z.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: C = None
        self.w: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: B = None
        self.t: D = None
        self.y: B = None
        self.txt = txt

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

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

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

d = A("d")
i = B("i")
m = C("m")
e = D("e")
f = E("f")
j = F("j")
c = A("c")

d.p = e
d.z = m
d.w = c
i.s = m
i.x = m
m.p = i
m.r = i
m.y = i
m.t = e
e.u = i
e.x = f
f.x = j
f.w = j
f.o = d
f.r = d
f.p = i
j.r = m
j.w = e
j.t = e
j.s = f
c.p = e
c.z = m
c.w = d
assert c.z.r.x.txt == "m"